Program to print the sum, difference, product & division of the two numbers JAVA


Write a Program to print the sum, difference, product & division of the two numbers.




import java.util.*;
class cal
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner (System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int sum,prod,div,diff;
        sum = a + b;
        div = a/b;
        prod = a * b;
        diff = a-b;
        System.out.println("Sum=" +sum + " " + "Difference=" + diff + " "+
        "Division=" +div + " " + "Product=" +prod);
    }
}

     
                     

Contact Us

REACH US

SERVICES

  • CODING
  • ON-LINE PREPARATION
  • JAVA & PYTHON

ADDRESS

B-54, Krishna Bhawan, Parag Narain Road, Near Butler Palace Colony Lucknow
Contact:+ 919839520987
Email:info@alexsir.com