0


Arithmetic Operators - The basic arithmetic operators in Java are the same as in most other computer languages, and correspond to our usual mathematical/algebraic symbolism.
Operators
Meaning
Example
Result
+
Addition
4+2
6
-
Subtraction
4-2
2
*
Multiplication
4*2
8
/
Division
4/2
2
%
Modulus operator to get remainder in integer division
5%2
1



Addition Program: -
class Geekyshows
{
    public static void main (String args[])
    {
        int a = 10;
        int b = 20;
        int c  = a + b;
        System.out.println("Addition: "+c);
    }
}


Subtraction Program: - 
class Geekyshows
{
    public static void main (String args[])
    {
        int a = 20;
        int b = 10;
        int c  = a - b;
        System.out.println("Subtraction: "+c);
    }
}

Check other arithmetic operators yourself

Post a Comment

Comment Rules :
1. Do not post Adult/illegal Links.
2. Try to comment in only English Language.
3. Do not post other website's links which are useless.
4. Your Comment should be based on the Topic for other queries Kindly Visit our Contact Us Page.
5. Do not use Abusive Language.
6. Respect each other.
Thank You for following the rules. Please Comment....

 
Top