Switch case advance usage
import java.util.*;
public class weekday {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Enter the number");
int n=sc.nextInt();
switch(n) {
case 1,2,3,4,5:{ System.out.println("week day"); break;}
case 6,7:{ System.out.println("week end"); break;}
default:System.out.println("Invalid Day");
}
}
}
Comments
Post a Comment