Skip to content

Commit e5ca425

Browse files
author
Yogesh5556
authored
Create asdffsdafs.cpp
1 parent 46803a6 commit e5ca425

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Diff for: asdffsdafs.cpp

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main() {
5+
6+
int year;
7+
cout << "Enter a year: ";
8+
cin >> year;
9+
10+
// leap year if perfectly divisible by 400
11+
if (year % 400 == 0) {
12+
cout << year << " is a leap year.";
13+
}
14+
// not a leap year if divisible by 100
15+
// but not divisible by 400
16+
else if (year % 100 == 0) {
17+
cout << year << " is not a leap year.";
18+
}
19+
// leap year if not divisible by 100
20+
// but divisible by 4
21+
else if (year % 4 == 0) {
22+
cout << year << " is a leap year.";
23+
}
24+
// all other years are not leap years
25+
else {
26+
cout << year << " is not a leap year.";
27+
}
28+
29+
return 0;
30+
}

0 commit comments

Comments
 (0)