Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Program to Check Leap Year

 C++ program to check leap year : c++ code to check leap year, year will be entered by the user.
Simply use of nested if else property..


Source Code:-

#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
  int year;
  cout<<"Program to check Leap year by-Tarun Rawat\n";
  cout<<"Enter a year to check : ";
  cin>>year;
  if ( year%400 == 0)
    cout<<year<<" is a leap year\n";
  else if ( year%100 == 0)
    cout<<year<<" is not a leap year\n";
  else if ( year%4 == 0 )
    cout<<year<<" is a leap year\n";
  else
    cout<<year<<" is not a leap year\n";
getch();

}

No comments:

Post a Comment

Blogger Widgets

Find Us On Google, Just type - way2cplusplus -

If you have any questions on implementing or understanding this C++ Program , shoot me a comment and I'll be glad to help! :) :)