Perform arithmetic operations without taking third variable in java

Write a java program to perform arithmetic operations without taking third variable.

public class cde 
{
    public static void main(String args[])
    {
        int a=4,b=2;
        System.out.println("a is:"+a);
        System.out.println("b is:"+b);
    
        System.out.println("addn is:"+(a+b));
        System.out.println("sub is:"+(a-b));
        System.out.println("mul is:"+(a*b));
        System.out.println("div is:"+(a/b));
        System.out.println("div is:"+(a%b));
    }
    
}

Leave a Reply

Your email address will not be published. Required fields are marked *