ALGORITHM
1 : Integer lyear
2 : Print''Enter the year''
3 : Input/year
4 ; If ((lyear %4==0) && (lyear% 100!==0)
(lyear%400==0)
{
Print lyear ''is a leap year''
else
Print lyear''is not a leap year''
}
5 : Stop
=========================================================================
#include<iostream.h.
#include,conio.h>
void main()
{
clrscr() ;
int lyear;
cout<<"\n Enter the year=";
cin>>lyear;
if((lyear%4==0)&&(lyear%100!=0)||(lyear%400==0)
cout<<lyear<<"is a leap year\n";
else
cout<<lyear<<"is not a leap year \n";
getch();
}
OUTPUT
Enter the year= 1996
1996 is a leap year
Enter the year= 2001
2001 is not a leap year
1 : Integer lyear
2 : Print''Enter the year''
3 : Input/year
4 ; If ((lyear %4==0) && (lyear% 100!==0)
(lyear%400==0)
{
Print lyear ''is a leap year''
else
Print lyear''is not a leap year''
}
5 : Stop
=========================================================================
#include<iostream.h.
#include,conio.h>
void main()
{
clrscr() ;
int lyear;
cout<<"\n Enter the year=";
cin>>lyear;
if((lyear%4==0)&&(lyear%100!=0)||(lyear%400==0)
cout<<lyear<<"is a leap year\n";
else
cout<<lyear<<"is not a leap year \n";
getch();
}
OUTPUT
Enter the year= 1996
1996 is a leap year
Enter the year= 2001
2001 is not a leap year
No comments:
Post a Comment