Advertisement
karlakmkj

Practice - check leap year

Mar 25th, 2021
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. //Program to find if it is a leap year
  2.  
  3. #include <iostream>
  4.  
  5. int main() {
  6.   int year;
  7.  
  8.   std::cout << "Enter year: \n";
  9.   std::cin >> year;
  10.  
  11.   if (year %4== 0 && year%100!=0 || year%400 ==0 ){
  12.   std::cout << year;  
  13.   std::cout << " is a LEAP year! \n";
  14.   }
  15.   else {
  16.   std::cout << year;
  17.   std::cout << " is not a leap year \n";
  18.   }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement