December 16, 2013 C++ Program to enter year in digit, print whether it is Leap year or not | ||||
---|---|---|---|---|
| ||||
Anyone wanted to know the C++ Leap year program in simple and easy way can go through this //Program name test078.cpp // program to Enter Year, Check and Print is it Leap year or not. #include <iostream.h> #include <conio.h> void main() { int yr; clrscr(); cout<<"Enter year in 4 digit format : "; cin>>yr; if((yr % 4 ==0) && (yr % 100 != 0 || yr % 400 == 0)) cout<<yr<<" is Leap year\n"; else cout<<yr<<" is NOT Leap year"; getch(); } Output Enter year in 4 digit format : 2000 2000 is Leap year Enter year in 4 digit format : 2005 2005 is NOT Leap year Enter year in 4 digit format : 2013 2013 is NOT Leap year more different types of programs in simple and easy way with online compiler check on cbtsam.com |
Copyright © 1999-2021 by the D Language Foundation