Write a display to Sunday to Saturday when user enters a number using switch case in c program .
Solutions :
#include < stdio.h >
int main()
{
int a;
printf("Enter a day number\n");
scanf("%d",& a);
switch (a) {
case 1:
printf("This means Sunday");
break;
case 2:
printf("This means Monday");
break;
case 3:
printf("This means Tuesday");
break;
case 4: printf("This means Wednesday");
break;
case 5: printf("This means Thursday");
break;
case 6: printf("This means Friday");
break;
case 7: printf("This means Saturday");
break;
default: printf("This is Invalid number");
}
return 0;
}
0 Comments