Create a Java program to print the day of the week by taking the day number as an input. Start Monday from no. 1.
Answers
Answered by
2
Answer:
import java.util.*;
class week
{
public static void main(String args[ ] )
{
int ch;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the choice");
ch=sc.nextInt();
switch(ch)
{
case 1: System.out.println("Monday");
break;
case 2: System.out.println("Tuesday");
break;
case 3: System.out.println("Wednesday");
break;
case 4: System.out.println("Thrusday");
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("Wrong choice");
break;
}
}
}
Similar questions