Computer Science, asked by supriyachakraborty20, 4 days ago

write q program the sum,differences,produce, quotient and remainder of two number 12 , 3​

Answers

Answered by 417sakshi20hvk
1

Answer:

If it's helpful for you so please mark me as brainlist

Explanation:

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

System.out.println("1. Sum without '+' operator");

System.out.println("2. Product without '*' operator");

System.out.println("3. Quotient and Remainder without '/' & '%' operators");

System.out.print("Enter your choice: ");

int choice = in.nextInt();

System.out.print("Enter m: ");

int m = in.nextInt();

System.out.print("Enter n: ");

int n = in.nextInt();

if (m > n) {

switch (choice) {

case 1:

while (n > 0) {

m++;

n--;

}

System.out.println("Sum = " + m);

break;

case 2:

int p = 0;

while (n > 0) {

p += m;

n--;

}

System.out.println("Product = " + p);

break;

case 3:

int q = 0;

while (m >= n) {

m = m - n;

q++;

}

System.out.println("Quotient = " + q);

System.out.println("Remainder = " + m);

break;

default:

System.out.println("Incorrect Choice");

break;

}

}

else {

System.out.println("Invalid Inputs");

}

}

}

Answered by rimateli1979
0

Answer:

sum= 15

difference= 9

produce= 36

quotient= 4

remainder= 0

Explanation:

sum:- 12+3= 15

difference:- 12-3= 9

produce:- 12×3= 36

quotient:- 12÷3= 4

remainder:- 12÷3= 0 in remainder

Similar questions