sahajjain01

Check if a year is a leap year.

Aug 4th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. //Program to check if a year is a leap year.
  2. #include<iostream.h>
  3. #include<conio.h>
  4. void main()
  5. {
  6.     clrscr();
  7.     int a,b;
  8.     cout<<"Enter a year: ";
  9.     cin>>a;
  10.     if(a%400==0)
  11.     cout<<"It's a leap year"<<endl;
  12.     else if(a%100==0)
  13.     cout<<"It's not a leap year"<<endl;
  14.     else if(a%4==0)
  15.     cout<<"It's a leap year"<<endl;
  16.     else
  17.     cout<<"It's not a leap year"<<endl;
  18.     getch();
  19. }
Advertisement
Add Comment
Please, Sign In to add comment