Thursday, January 20, 2011

Any year is input through the keyboard. Write a program to determine whether the year is leap year or not. (Hint: Use the % (modulus) operator

#include<stdio.h>
main()
{

int year;

printf ("Enter the year to be checked for validity as a Leap Year:");
scanf ("%d", &year);

if (year%4==0)
{
printf ("The year is a Leap Year.\n");

}
else
{
printf("The year is not a Leap Year.\n");

}
}

No comments:

Post a Comment