//Write a program to display name of day on the basis of entered number.
//. for example, 2 for Monday.
#include<stdio.h>
#include<conio.h>
void main()
{
int choice;
printf("enter number for day\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("Today is Sunday\n");
break;
case 2:
printf("Today is Monday\n");
break;
case 3:
printf("Today is Tuesday\n");
break;
case 4:
printf("Today is Wednesday\n");
break;
case 5:
printf("Today is Thursday\n");
break;
//. for example, 2 for Monday.
#include<stdio.h>
#include<conio.h>
void main()
{
int choice;
printf("enter number for day\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("Today is Sunday\n");
break;
case 2:
printf("Today is Monday\n");
break;
case 3:
printf("Today is Tuesday\n");
break;
case 4:
printf("Today is Wednesday\n");
break;
case 5:
printf("Today is Thursday\n");
break;
case 6:
printf("Today is Friday\n");
break;
printf("Today is Friday\n");
break;
case 7:
printf("Today is Saturday\n");
break;
printf("Today is Saturday\n");
break;
default:
printf("sorry, not a valid input(beyond 7!!!!\n");
printf("thank u, terminating....\n");
}
getch();
}
note:
here, you can use 'char' data type instead 'int' and you can input data before switch statement as well.
printf("sorry, not a valid input(beyond 7!!!!\n");
printf("thank u, terminating....\n");
}
getch();
}
note:
here, you can use 'char' data type instead 'int' and you can input data before switch statement as well.