Any year is entered through the keyboard, write a program to determine whether the year is leap year or not. Use the logical operators && and ||.
#include <stdio.h>
#include <conio.h>
void main( )
{
int y;
clrscr ( );
printf ("\n Enter year............:"); scanf ("%d",&y);
if ( y % 400 == 0 || y % 100 != 0 && y % 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 y;
clrscr ( );
printf ("\n Enter year............:"); scanf ("%d",&y);
if ( y % 400 == 0 || y % 100 != 0 && y % 4 == 0 )
printf ("\n LEAP YEAR");
else
printf ("\n NOT LEAP YEAR");
getch ( );
}
To contact us
No comments:
Post a Comment