C Program to Print Day Based on Given Number using Switch Case
Write a Program to Print Day Based on a Given Number using Switch Case
#include <stdio.h>
int main()
{
int n;
printf("Enter the number :--> ");
scanf("%d", &n);
switch(n)
{
case 1:
printf("The day is Monday");
break;
case 2:
printf("The day is Tuesday");
break;
case 3:
printf("The day is Wednesday");
break;
case 4:
printf("The day is Thursday");
break;
case 5:
printf("The day is Friday");
break;
case 6:
printf("The day is Saturday");
break;
case 7:
printf("The day is Sunday");
break;
default:
printf("Please enter the correct input (Between 1 and 7)");
}
return 0;
}
Output:
Run 1:
Enter the number :--> 7
The day is Sunday
Run 2:
Enter the number :--> 0
Please enter the correct inputs