Monday, 16 October 2017

How to write a programme in C++ to check whether the entered year in four digit by the user is leap year or not .


In this blog we will see how to write a programme in C++ to check whether the entered year in four digit by the user is leap year or not, you can do so by following the given steps below.

Step 1: Go to your C++ compiler and type the given programme.



 #include<iostream.h>
 #include<conio.h>
 void main()
 {
 int year;
 cout<<"Enter four digit year of your choice";
 cin>>year;
 if(year%4==0)
 cout<<"It is a leap year"; 
 else
 cout<<"It is a non-leap year";
 getch();
 }


Step 2: Compile(alt+c) your programme and run(alt+r).
Share:
Categories

0 comments:

Post a Comment