14. Write a C program to read no 1 to 7 and print relatively day Sunday to Saturday.
#include<stdio.h>
#include<conio.h>
void main()
{
int day;
printf("Enter the no from 1 to 7 to find corresponding : ");
scanf("%d",&day);
switch (day)
{
case 1:
printf("Sunday");
break;
case 2:
printf("Monday");
break;
case 3:
printf("Tuesday");
break;
case 4:
printf("Wednesday");
break;
case 5:
printf("Thursday");
break;
case 6:
printf("Friday");
break;
case 7:
printf("Saturday");
break;
default:
printf("Enter the proper input\n");
break;
}
getch();
}
#OUTPUT:
#include<conio.h>
void main()
{
int day;
printf("Enter the no from 1 to 7 to find corresponding : ");
scanf("%d",&day);
switch (day)
{
case 1:
printf("Sunday");
break;
case 2:
printf("Monday");
break;
case 3:
printf("Tuesday");
break;
case 4:
printf("Wednesday");
break;
case 5:
printf("Thursday");
break;
case 6:
printf("Friday");
break;
case 7:
printf("Saturday");
break;
default:
printf("Enter the proper input\n");
break;
}
getch();
}
#OUTPUT:
Comments
Post a Comment