Write Java program to accept a number from the user if the first number is greater than second calculate their sum else calculate their product
Answers
Answer:
import java.util.*;
class SumProd
{
public void main()
{
Scannsr sc = new Scanner(System.in);
System.out.println("Enter first number: ");
int a = sc.nextInt();
System.out.println("Enter second number: ");
int b = sc.nextInt();
if(a > b)
{
int sum = a+b;
System.out.println("Sum of " + a + " and " + b " is " + sum);
}
else
{
int product = a*b;
System.out.println("Product of " + a + " and " + b " is " + product);
}
}
}
I hope you find it useful... If you have any query, feel free to ask me in the comments...
Answer:
tgyucuyguycguy
Explanation:
hgcjgjhgkhvhkuvkj