Advertisement
H0_0H

Untitled

Dec 2nd, 2021
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long LL;
  4.  
  5. bool check(int n){
  6.     return n % 4 == 0 && n % 100 != 0 || n % 400 == 0;
  7. }
  8.  
  9. void fun(int s, int e){
  10.     int sum = 0;
  11.     for (int i = s; i < e; i++)
  12.         if (check(i)) sum ++;
  13.     printf("%d", sum);
  14. }
  15.  
  16. int main()
  17. {
  18.   int start_year = 2000, end_year = 2400;
  19.   fun(start_year, end_year);
  20.   return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement