Manu

Saturday, November 19, 2016

WAP to enter two numbers and perform mathematical operations on them

CODE:
import java.util.Scanner;
public class mathematical
{
    public static void main(String args[])
    {
       int a, b;
       Scanner scan = new Scanner(System.in);              
       System.out.print("Enter Two Numbers : ");
       a = scan.nextInt();
       b = scan.nextInt();
              
       System.out.println("Addition = "+(a+b));             
       System.out.println("Subtraction = " +(a-b));
       System.out.println("Multiplication = " +(a*b));
       System.out.println("Division = " +(a/b));
    }
}
OUTPUT:

No comments:

Post a Comment