1 solutions
-
0
C :
#include <stdio.h> int main() { int year, a, b, c; scanf("%d", &year); a = year % 4; if(a == 0) { b = year % 100; if(b == 0) { c = year % 400; if(c == 0) printf("leap year\n"); else printf("not leap year\n"); } else printf("leap year\n"); } else printf("not leap year\n"); return 0; system("pause"); }C++ :
#include <iostream> using namespace std; int main() { int a; cin>>a; if(a%100==0) { if(a%400==0) cout<<"leap year"<<endl; else cout<<"not leap year"<<endl; } else { if(a%4==0) cout<<"leap year"<<endl; else cout<<"not leap year"<<endl; } return 0; }
- 1
Information
- ID
- 17671
- Time
- 1000ms
- Memory
- 12MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By