28 January, 2013

C++ Program To Find A Leap Year.

This Post Contains A C++ Program To Find A Leap Year With Correct Source Code & Output.
This Program Is Written, Compiled & Executed At TurboC3.0 Compiler & Will Help You To Understand The Concept Of 'If...else' From C++ Language. It Is A Well-Structured Program With Proper Comments Which Provides Step-By-Step Description Of Various Features Of The Language In A Simple & Easy-To-Understand Way.

# Note : You Can Simply Copy-Paste The Following Program Or Code Into Compiler For Direct Result.

C++ Program To Find A Leap Year.

/* Declaration Of Header Files */
# include <iostream.h>
# include <conio.h>

/* Start Of Main Program */
void  main()
{
         /* Declaration Of Variables */
         int Num=0;
         clrscr();
      
         /* Asking For The Input From User */  
         cout << " \n Please Enter The Year = \t " ;
         cin >> Num ;
      
         /* Code For Determining The Leap Year */
         if ( ( Num % 4 == 0 ) && (Num % 100 != 0) || (Num % 400 == 0 ) )
                cout << " \n The Entered Year Is A 'LEAP YEAR' " ;
         else
                cout << " \n The Entered Year Is Not A 'LEAP YEAR' " ;

         getch();
}
/* End Of Main Program */



No comments:

Post a Comment

Subscribe To:

Most Commonly Asked Programs In 'C' & 'C++' Language.