C program to print weekday by reading the day number by using the switch case

C program to print weekday by reading the day number by using the switch case:

Here I shared the C program of performing to print weekday by reading the day number by using a switch case statement.

For example, if the user enters day 5 then the output will be like: 

 Enter the day between(1-7): 5
 friday




#include<stdio.h>
int main()
{
   int week;
     printf("\n Enter the day between(1-7): \t");
      scanf("%d",&week);
       switch(week)
         {
  case 1:
        printf("Monday");
        break;
  case 2:
               printf("Tuesday");
        break;
  case 3:
        printf("Wednesday");
        break;
  case 4:
        printf("thursday");
        break;
  case 5:
        printf("friday");
        break;
  case 6:
        printf("Saturday");
        break;
  case 7:
        printf("Sunday");
        break;
  default:
   printf("Invalid No.,No. is not between 1-7");
  }
 return 0;
}

NOTE: You have any problem in above C Program do not hesitate and write your problem in the comment box. I will support your problem.

Share this

0 Comment to "C program to print weekday by reading the day number by using the switch case"

Post a Comment