WAP to find out whther a year is a leap year .
#include<iostream.h>
#include<conio.h>
void main()
{ int year;
cout<<"Enter the year:";
cin>>year;
if(year%100==0)
{ if(year%400==0)
cout<<"Leap Year\n";
}
else if(year%4==0)
cout<<"Leap year\n";
else
cout<<"Not a leap year\n";
getch();
}
#include<conio.h>
void main()
{ int year;
cout<<"Enter the year:";
cin>>year;
if(year%100==0)
{ if(year%400==0)
cout<<"Leap Year\n";
}
else if(year%4==0)
cout<<"Leap year\n";
else
cout<<"Not a leap year\n";
getch();
}
Comments
Post a Comment