//WAP to display the name of day on the basis of entered number 1 to 7 using switch. For example, 1 //for Sunday.
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int choice;
int number,output;
printf("'we have following menu\n");
printf( "1.for Sunday\n");
printf("2. for Monday\n");
printf("3 for Tuesday\n");
printf("4 for Wednesday\n");
printf("5 for Thrusday\n");
printf("6 for Friday\n");
printf("7 for Saturday\n");
printf("enter your choice 1 or 2 or 3 or 4 or 5 or 6 or 7 or any other number to exit\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("It's Sunday\n");
break;
case 2:
printf("It's Monday\n");
break;
case 3:
printf("IT's Tuesday\n");
break;
case 4:
printf("It's Wednesday\n");
break;
case 5:
printf("It's Thrusday\n");
break;
case 6:
printf("It's Friday\n");
break;
case 7:
printf("It's Saturday\n");
break;
default:
printf("sorry, not a valid input\n");
printf("thank u, terminating....\n");
}
getch();
}
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int choice;
int number,output;
printf("'we have following menu\n");
printf( "1.for Sunday\n");
printf("2. for Monday\n");
printf("3 for Tuesday\n");
printf("4 for Wednesday\n");
printf("5 for Thrusday\n");
printf("6 for Friday\n");
printf("7 for Saturday\n");
printf("enter your choice 1 or 2 or 3 or 4 or 5 or 6 or 7 or any other number to exit\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("It's Sunday\n");
break;
case 2:
printf("It's Monday\n");
break;
case 3:
printf("IT's Tuesday\n");
break;
case 4:
printf("It's Wednesday\n");
break;
case 5:
printf("It's Thrusday\n");
break;
case 6:
printf("It's Friday\n");
break;
case 7:
printf("It's Saturday\n");
break;
default:
printf("sorry, not a valid input\n");
printf("thank u, terminating....\n");
}
getch();
}
No comments:
Post a Comment