accept two numbers from the user . using switch case calculate sum, difference,product and quotient in java
Answers
Answered by
0
Answer:
import java.util.Scanner;
class assignment
{
int sum,product,difference,average, quotient;
public static void main ()
{
Scanner sc=new Scanner(System.in);
int num1=sc.nextInt();
int num2=sc.nextInt();
double sum =num1+num2;
double product =num1*num2;
double difference =num1-num2;
double average =(num1+num2)/2;
double quotient=num1/num2;
System.out.println(" Sum is: "+sum);
System.out.println(" Difference is: "+difference);
System.out.println(" Product is: "+product);
System.out.println(" Average is: "+average);
System.out.println(" Quotient is: "+quotient);
}
}
Explanation:
Similar questions