25-Write a C program to display the name of week by number entered through the keyboard.

Program: 25

Write a C program to display the name of week by number entered through the keyboard.

#include
#include
void main()
{
    int x;
    printf("Enter any week's value from 1 to 7: ");
    scanf("%d", &x);
    switch(x)
    {
    case 1:
        printf("Sunday is the first day of the week.");
        break;
    case 2:
    printf("Monday is the second day of the week.");
    break;
     case 3:
       printf("Tuesday is the third day of the week.");
        break;
     case 4:
       printf("Wednesday is the fourth day of the week.");
        break;
      case 5:
       printf("Thursday is the fifth day of the week.");
        break;
      case 6:
        printf("Friday is the sixth day of the week.");
        break;
      case 7:
        printf("Saturday is the seventh day of the week.");
        break;
        }
getch();
}
Output
Enter any week's value from 1 to 7: 3
Tuesday is the third day of the week.
Lokesh Kumar: Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.
Related Post
Leave a Comment

This website uses cookies.