Question-Any year is entered through the keyboard. Write a function to
determine whether the year is a leap year or not
Solution-
An easy one.
#include<stdio.h>
int main()
{
int yr;
printf("Enter any year\n");
scanf("%d",&yr);
leap(yr);
return 0;
}
leap(int yr)
{
if(yr%4==0||yr%100==0&&yr%400==0)
printf("Entered year is leap year\n");
else
printf("it's not a leap year\n");
}
determine whether the year is a leap year or not
Solution-
An easy one.
#include<stdio.h>
int main()
{
int yr;
printf("Enter any year\n");
scanf("%d",&yr);
leap(yr);
return 0;
}
leap(int yr)
{
if(yr%4==0||yr%100==0&&yr%400==0)
printf("Entered year is leap year\n");
else
printf("it's not a leap year\n");
}
No comments:
Post a Comment