Print day of week by taking numbers from 1-7.

This post content:-
  • Algorithm
  • Flowchart
  • C code
  • Output
  • PDF notes
Algorithm:-
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

Popular posts from this blog

Develop and execute C Program to Add Two Distances given in kilometer-meter Using Structures.

Develop a c program to find the sum of all elements stored in a given array using a pointer.