Computer Science, asked by adi11746, 1 year ago

write a java program using switch case to accept a number from the user and print the corresponding name of the week day

Answers

Answered by sikhi
9
hope it helps you.........
Attachments:

adi11746: ya thnq
sikhi: ur welcome
Answered by Brenquoler
78

import java.util.*;

class Hello

{

public static void main (string args [])

{

Scanner sc=new Scanner(System .in);

int d;

System.out.println("Enter a day no.");

d=sc.nextInt();

switch=(d)

{

Case1: System.out.println("Monday");

break;

Case2: System.out.println("Tuesday");

break;

Case3: System.out.println("Wednesday");

break;

Case4: System.out.println("Thursday");

break;

Case5: System.out.println("Friday");

break;

Case6: System.out.println("Saturday");

break;

Case7: System.out.println("Sunday");

break;

default: System.out.println("Wrong Day");

}

}

}

Attachments:
Similar questions