Breaking

Search This Blog

Friday 17 August 2018

Java Program Using All Arithmetic and Assignment Operators

Java Program Using All Arithmetic Operators


Java Program Using All Arithmetic and Assignment 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("substraction of two number is"+ o);
}

}



Arithmetic Operators
Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication etc.
 
Java Arithmetic Operators
OperatorMeaning
+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

*if you have any question comment on this post   











4 comments:

  1. 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

    ReplyDelete
  2. Awesome 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

    ReplyDelete
  3. 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

    ReplyDelete

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();