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

In this example, I shared c program of performing to print weekday by reading the day number by using a switch case statement.

C - Print Weekday By Reading Day Number


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.

If you have any doubts, Please let me know

Previous Post Next Post

Contact Form