Let us see the Switch statement program to find a weekday.
Flowchart of the program to find weekday
Switch statement program Source Code to find weekday from day number
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#include<iostream> using namespace std; int main() { int a; cout<<"Enter No. of Days (1-7) "; cin>>a; switch(a) { case 1: cout<<"Its Monday"; break; case 2: cout<<"Its tuesday"; break; case 3: cout<<"Its wednesday"; break; case 4: cout<<"Its thusday"; break; case 5: cout<<"It's Friday"; break; case 6: cout<<"Its saturday"; break; case 7: cout<<"Its sunday"; break; } }
|
Output
Enter No. of Days (1-7)
5
It’s Friday
SFT (Shamil’s Flow Table )
Are you interested to Read about SFT(Shamil’s Flow Table)?