//find a year is leap year or not, using if else statement
# include <stdio.h>
int main (){
int y;
printf ("enter the year :");
scanf ("%i",&y);
if (y%4==0){
if (y%100==0){
if (y%400==0)
printf ("%i is a leap year ",y);
else
printf ("%i is not a leap year ",y);
}
else printf ("%i is a leap year ",y);
}
else printf ("%i is not a leap year ",y);
return 0;
}
No comments:
Post a Comment