Program to check a leap year.
As we know if year is multiple of 4 than its a
Leap year other wise its not a leap year.
Here in this program we use our these small
Observation to utilize as a code and make a
program that tell us about leap year we first
allow user to put an input in by showing some
some text eg:- enter you year ,or enter year
to check for leap year and after that we apply
some basic formula and give the out as yes this year
Is a leap year.
Q) Write a program to check a leap year?
Sol
#include<iostream.h>
using namespace std;
int main()
{
int year;
cout <<"enter year to check for leap year";
cin>>year;
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0));
cout<< year<<" is a leap year";
else
cout<<year<<" is not a leap year";
return 0;
}
else
cout<<year<<" is not a leap year";
return 0;
}
Other related post:-
Shutdown someone pc using notepad trick
Let window speak to you
Create quiz game using notepad
Program to check planidrome
Find factorial using program
Program to check leap year
Program to sort an array
Program to multiply two matrixes
Program to find root of quadratic equations
Array coding interview questions
Program creating basic calculator
Program to convert Fahrenheit to Celsius or Celsius to Fahrenheit
Program to implement distance formula
Top featured feeds
Top pattern problems
Array coding interview questions
0 Comments
if you have any doubt let me know in comment