Advertisement
Josif_tepe

Untitled

Dec 16th, 2023
599
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int m, g;
  6.     cin >> m >> g;
  7.    
  8.     if(m == 2) {
  9.         if(g % 400 == 0) {
  10.             cout << 29 << endl;
  11.         }
  12.         else if(g % 4 == 0 and g % 100 != 0) {
  13.             cout << 29 << endl;
  14.         }
  15.         else {
  16.             cout << 28 << endl;
  17.         }
  18.     }
  19.     else if(m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m == 10 or m == 12) {
  20.         cout << 31 << endl;
  21.     }
  22.     else {
  23.         cout << 30 << endl;
  24.     }
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement