Ticker

6/recent/ticker-posts

Header Ads Widget

Program to check a leap year

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.

Program to check 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;
}






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

Post a Comment

0 Comments