C program to Print Day Name of Week using switch case

//C program to Print Day Name of Week using switch case:-


#include<stdio.h>
#include<conio.h>
void main()
{
int week;
clrscr();
printf("Enter week number(1-7): ");
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 input! Please enter week number between (1-7).");
}
getch();
}

======================

OUTPUT:-

Enter week number(1-7): 5
Friday         

======================                                                             
     
C program to Print Day Name of Week using switch case

Comments