Print day of week by taking numbers from 1-7.
This post content:-
- Algorithm
- Flowchart
- C code
- Output
- PDF notes
Step 1:- start.
Step 2:- declare variables num.
Step 3:- take input of the num.
Step 4:- make switch statement as follow:-
switch (num)
{
case 1:
printf("Monday");
break;
case 2:
printf("Tuesday ");
break;
case 3:
printf("Wednesday ");
case 4:
printf("Thursday ");
break;
case 5:
printf("Friday ");
break;
case 6:
printf("Saturday ");
break;
case 7:
printf("Sunday ");
break;
default :
printf("invalid day");
}
Step 5:- END.
Flowchart :-
C code:-
Output:-
Try it yourself:-
Comments
Post a Comment