Computer Science, asked by arif6033, 3 months ago

WAP to input no of week's day and translate to its equivalent name of the day of the week(example:- 1 to Monday ,2 to Monday.........,7 to Sunday)

Answers

Answered by himanshu2006vps
1

Answer:

import java.util.Scanner;

public class DayName

{

public static void main(String[] args)

{

Scanner scanner = new Scanner(System.in);

System.out.println("Enter weekday day number (1-7) : ");

int weekday = scanner.nextInt();

if(weekday == 1)

{

System.out.println("Monday");

}

else if(weekday == 2)

{

System.out.println("Tuesday");

}

else if(weekday == 3)

{

System.out.println("Wednesday");

}

else if(weekday == 4)

{

System.out.println("Thursday");

}

else if(weekday == 5)

{

System.out.println("Friday");

}

else if(weekday == 6)

{

System.out.println("Saturday");

}

else if(weekday == 7)

{

System.out.println("Sunday");

}

else

{

System.out.println("Please enter weekday number between 1-7.");

}

}

}

Similar questions