To check a year is leap or not in C
Input :
Output :
Code :
#include <stdio.h>
int main()
{
int c;
printf("Enter the year :\n");
scanf("%d",&c);
{if ((c%4==0)&&(!(c%100==0)||(c%400==0)))
printf("The year is a leap year\n");
else
printf("The year is not a leap year\n");
}
return 0;
}
Input :
Output :
Code :
#include <stdio.h>
int main()
{
int c;
printf("Enter the year :\n");
scanf("%d",&c);
{if ((c%4==0)&&(!(c%100==0)||(c%400==0)))
printf("The year is a leap year\n");
else
printf("The year is not a leap year\n");
}
return 0;
}
0 Comments:
Post a Comment