Decision Statements 107
c lrs c r () i
printf ("Enter a number between lto7
scanf ("%d",(kday);
for (id ,‘i<’=day,'i++)
switch(i) I
case 1 :
printf(*nlst day of week is Sunday");
break;
case 2:
printf (u
2nd day of week is Monday");
break;
case 3:
printf ("n3rd day of week is Tuesday");
break;
case 4;
printf (“
4th day of week is Wednesday");
break;
case 5:
printf ("
5th day of week is Thursday");
break;
case 6:
printf ("
6th day of week is Friday");
break;
case 7:
printf (“
7th day of week is Saturday");
break;
default:
printf ("
Invalid day");
}
)
OUTPUT;
Enter a number between 1 to 7 :4
1st day of week is Sunday
2nd day of week is Monday
3rd day of week is Tuesday
4th day of week is Wednesday
Explanation In this program the sw itch () case structure is used as usual.
5.24 Write a program to perform following operations.
1.Display any numbers or stars on the screen by using for loop.
2. Display the menu containing the following
a) Whole screen, b) Half Screen, c) Top 3 lines d) Bottom 3 lines.