import java.util.Scanner;
public class ConditionalSwitch {
public static void main(String[] args) {
Scanner in = new Scanner (System.in);
int a,b,c=1;
System.out.println("First number must be 1 to 5 and second from 1 to 100");
System.out.print("Enter first number = ");
a=in.nextInt();
System.out.print("Enter second number = ");
b=in.nextInt();
switch(a)
{
case 1:
if (b<100 && b>1)
{
c = a * b;
System.out.println("Product of both numbers = "+c);
}
else
System.out.println("Second number must be from 1 to 100");
break;
case 2:
if (b<100 && b>1)
{
c = a + b;
System.out.println("Sum of both numbers = "+c);
}
else
System.out.println("Second number must be from 1 to 100");
break;
case 3:
if (b<100 && b>1)
{
c = a - b;
System.out.println(""+a+" - "+b+" = "+c);
}
else
System.out.println("Second number must be from 1 to 100");
break;
case 4:
if (b<100 && b>1)
{
c = a / b;
System.out.println(""+a+" / "+b+" = "+c);
}
else
System.out.println("Second number must be from 1 to 100");
break;
case 5:
if (b<100 && b>1)
{
c = b % a;
System.out.println("Remainder of "+b+" / "+a+" = "+c);
}
else
System.out.println("Second number must be from 1 to 100");
break;
default:
System.out.println("First number must be from 1 to 5");
}
}
}
public class ConditionalSwitch {
public static void main(String[] args) {
Scanner in = new Scanner (System.in);
int a,b,c=1;
System.out.println("First number must be 1 to 5 and second from 1 to 100");
System.out.print("Enter first number = ");
a=in.nextInt();
System.out.print("Enter second number = ");
b=in.nextInt();
switch(a)
{
case 1:
if (b<100 && b>1)
{
c = a * b;
System.out.println("Product of both numbers = "+c);
}
else
System.out.println("Second number must be from 1 to 100");
break;
case 2:
if (b<100 && b>1)
{
c = a + b;
System.out.println("Sum of both numbers = "+c);
}
else
System.out.println("Second number must be from 1 to 100");
break;
case 3:
if (b<100 && b>1)
{
c = a - b;
System.out.println(""+a+" - "+b+" = "+c);
}
else
System.out.println("Second number must be from 1 to 100");
break;
case 4:
if (b<100 && b>1)
{
c = a / b;
System.out.println(""+a+" / "+b+" = "+c);
}
else
System.out.println("Second number must be from 1 to 100");
break;
case 5:
if (b<100 && b>1)
{
c = b % a;
System.out.println("Remainder of "+b+" / "+a+" = "+c);
}
else
System.out.println("Second number must be from 1 to 100");
break;
default:
System.out.println("First number must be from 1 to 5");
}
}
}