/* 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<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;
}
//above pgm is correct bt not working properly for all input like 1900,1700 etc
ReplyDelete//below pgm is working correctly
//check wheter leap year or not
#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;
}
he is correct
Deleteif(((year%4==0)&&(year%100!=0))||(year%400==0))
Deleteprintf("%d is a leap year",year);
else
printf("%d is not a leap year",year);
yup, this is precisely correct..
Delete1900 isn't a leap year...
Delete#include
ReplyDeletemain()
{
int year;
printf("\nEnter the Year\n");
scanf("%d",&year);
if(year%400==0)
printf("\nLEap year");
else if(year%4==0)
printf("\nLEap year");
else if(year%100==0)
printf("\nCommon YEar");
else
printf("\nCommon YeaR");
}
also works