Any year is input through the keyboard. Write a program to determine whether the year is a leap year or not.
#include <stdio.h>
#include <conio.h>
void main( )
{
int yr;
clrscr ( );
printf ("\n Enter a year.....:"); scanf ("%d",&yr);
if ( yr % 100 == 0 )
{
if ( yr % 400 == 0)
printf ("\n LEAP YEAR");
else
printf ("\n NOT LEAP YEAR");
}
else
{
if ( yr % 4 == 0 )
printf ("\n LEAP YEAR");
else
printf ("\n NOT LEAP YEAR");
}
getch ( );
}
To contact us
#include <stdio.h>
#include <conio.h>
void main( )
{
int yr;
clrscr ( );
printf ("\n Enter a year.....:"); scanf ("%d",&yr);
if ( yr % 100 == 0 )
{
if ( yr % 400 == 0)
printf ("\n LEAP YEAR");
else
printf ("\n NOT LEAP YEAR");
}
else
{
if ( yr % 4 == 0 )
printf ("\n LEAP YEAR");
else
printf ("\n NOT LEAP YEAR");
}
getch ( );
}
To contact us
No comments:
Post a Comment