WAP in java to input two numbers. Find the sum difference product quotient and reminder
Answers
Import java.util.Scanner;
class maths
{
public void calculation()
{
Scanner sc=new Scanner(System.in);
System.out.println(''ente the value of a'');
int a=sc.nextInt();
System.out.println(''enter the value of b'');
int sum=a+b;
int diff=a-b;
int pro=a*b;
int quo=a/b;
System.out.println(sum);
System.out.println(diff);
System.out.println(pro);
System.out.println(quo);
}
}
import java.util.*;
class number
{
public static void main(String args[])
{
Scanner in=new Scanner (System.in);
int a,b,s,d,p,r,q;
System.out.println("Enter a and b: ");
a=in.nextInt();
b=in.nextInt ();
s=a+b;
d=a-b;
p=a*b;
q=a/b;
r=a%b;
System.out.println("Sum: "+s);
System.out.println("Difference: "+d);
System.out.println("Product: "+p);
System.out.println("Quotient: "+q);
System.out.println("Remainder: "+r);
}
}