PROBABLY WE CAN USED SWITCH STATEMENT FOR THIS PROGRAM. THE BELOW PROGRAM I HAVE USED SWITCH STATEMENT.
#include<stdio.h>
#include<conio.h>
void main()
{
int no;
clrscr();
printf("Print the day\n");
scanf("%d",&no);
switch(no)
{
case 1:
printf("Monday");
break;
case 2:
printf("Tuesday");
break;
case 3:
printf("Wednesday");
break;
case 4:
printf("Thursday");
break;
case 5:
printf("Friday");
break;
case 6:
printf("Saturday");
break;
case 7:
printf("Sunday");
break;
default:
printf("Invalid input");
}
getch();
}
THIS PROGRAM IS VERY SIMPLE FOR THE PROGRAMMERS WHO KNOWS ABOUT SWITCH STATEMENT.
SO BEFORE CODING THIS PROGRAM WE HAVE TO KNOW ABOUT SWITCH STATEMENT.
No comments:
Post a Comment