Java Program Using All Arithmetic Operators
Java Program Using All Arithmetic and Assignment Operators |
class Arithmetic
{
public static void main(String s[])
{
int a=23, b=18, c;
c=a+b;
System.out.println("addition of two number is"+ c);
int p=23, q=18, r;
r=p*q;
System.out.println("multiply of two number is"+ r);
int w=23, e=18, x;
x=w/e;
System.out.println("division of two number is"+ x);
int m=23, n=18, o;
o=m-n;
System.out.println("substracti on of two number is"+ o);
}
}
{
public static void main(String s[])
{
int a=23, b=18, c;
c=a+b;
System.out.println("addition of two number is"+ c);
int p=23, q=18, r;
r=p*q;
System.out.println("multiply of two number is"+ r);
int w=23, e=18, x;
x=w/e;
System.out.println("division of two number is"+ x);
int m=23, n=18, o;
o=m-n;
System.out.println("substracti
}
}
Arithmetic Operators
Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication etc.
Operator | Meaning |
---|---|
+ | Addition (also used for string concatenation) |
- | Subtraction Operator |
* | Multiplication Operator |
/ | Division Operator |
% | Remainder Operator |
Assignment Operator
Assignment operators are used in Java to assign values to variables. For example,
int tech; tech = 5;
Example 1: Assignment Operator
class AssignmentOperator {
public static void main(String[] args) {
int value1, value2;
// Assigning 5 to value1 value1 = 5; System.out.println(value1);
// Assigning value of variable value2 to value1 value2 = value1; System.out.println(value2); }
}
When you run the program, the output will be:
5 5
It's Amazing Blog!
ReplyDeleteHair Transplant in Kurukshetra
PRP Treatment in Delhi
Hair Transplant in Ghaziabad
Best Meso Therapy Treatment in Delhi
We are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up. Great work. teknisk analys program
ReplyDeleteAwesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! teknisk analys aktier
ReplyDeleteWe are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up. Great work. teknisk analys program
ReplyDelete