Computer Science, asked by priyanshudas2005, 1 year ago

WAP in java to input two numbers. Find the sum difference product quotient and reminder

Answers

Answered by kishanrajsah321
17

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);
}
}


kishanrajsah321: please add one line between 9th and 10th line,int b=sc.nextInt();
kishanrajsah321: sorry for trouble it was my mistake!
Answered by ankitasn333
16

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);
}
}

Similar questions