10.switch case in java
import java.util.*;
class day
{
public static void main(String arg[])
{
Scanner obj = new Scanner(System.in);
int no;
System.out.print("Enter 1 to 7 number : ");
no = obj.nextInt();
switch(no)
{
case 1: System.out.println("Monday");
break;
case 2: System.out.println("Tuesday");
break;
case 3: System.out.println("Wednday");
break;
case 4: System.out.println("Thersday");
break;
case 5: System.out.println("Friday");
break;
case 6: System.out.println("Saturday");
break;
case 7: System.out.println("Sunday");
break;
default : System.out.println("Invalid Number");
}
}
}
Comments
Post a Comment