Advertisement
avr39ripe

cppDaysInYear

Jun 9th, 2021
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5.     const int daysInYear{ 365 };
  6.     int days{ daysInYear };
  7.     int year;
  8.  
  9.     std::cout << "Enter year number:\n";
  10.     std::cin >> year;
  11.  
  12.     //days += year % 4 == 0;
  13.  
  14.     days = days + (((year % 400 == 0) or (year % 4) == 0) and ((year % 100) != 0));
  15.  
  16.  
  17.  
  18.     std::cout << "In " << year << " there are " << days << " days.\n";
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement