Leap Year

/* Check Leap Year */ 
#include<stdio.h>
int main()
{
    int y;
    printf("Enter a year: ");
    scanf("%d",&y);
    if(y%4==0)
        printf("Leap Year");
    else
        printf("Not a Leap Year");
   return 0; 
}



-------------------------------------------------------------------------------------------------------------------


#include
int main()
{
int year;
printf("enter the year:\n");
scanf("%d",&year);
if(year%4==0&&(year%400==0||year%100!=0))
printf("This is a leap year:");
else
printf("This isnot a leap year:\n");
return 0;
}

No comments:

Post a Comment