C++ Program to Check Leap Year
Advertisements
C++ Program to Check Leap Year
A Leap Year is a year containing one additional day that means in that year 366 day. and these year are divisible by 4 so if you write this program must be check year divisible by 4.
C++ Program to Check Leap Year
#include<iostream.h> #include<conio.h> void main() { int y; cout<<"Enter a year: "; cin>>y; if(y%4==0) { cout<<"Leap Year"; } else { cout<<"Not a Leap Year"; } getch(); }
Output
Enter a year: 2004 Leap Year
Google Advertisment