-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path14-weekdays.cpp
More file actions
43 lines (37 loc) · 926 Bytes
/
14-weekdays.cpp
File metadata and controls
43 lines (37 loc) · 926 Bytes
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
33
34
35
36
37
38
39
40
41
42
43
// Program to print weekdays
#include <iostream>
using namespace std;
int main() {
int week;
// Input week number
cout << "Enter the week number (1 to 7): ";
cin >> week;
// Using swtich to determine the weekday
switch (week) {
case 1:
cout << "Monday" << endl;
break;
case 2:
cout << "Tuesday" << endl;
break;
case 3:
cout << "Wednesday" << endl;
break;
case 4:
cout << "Thursday" << endl;
break;
case 5:
cout << "Friday" << endl;
break;
case 6:
cout << "Saturday" << endl;
break;
case 7:
cout << "Sunday" << endl;
break;
default:
cout << "Invalid week number. Please enter a number between 1 and 7." << endl;
break;
}
return 0;
}