luc044.c (589B)
1 /* Any year is entered through the keyboard. Write a function to 2 determine whether the year is aleap year or not. */ 3 /* Let Us C, Chap- 8, Page - 144, Qn No.: C(1) */ 4 5 #include <stdio.h> 6 7 int leapYear(int); 8 9 int leapYear(int year) 10 { 11 if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) 12 return 1; 13 else 14 return 0; 15 } 16 17 int main() 18 { 19 int year; 20 printf("Enter the year : "); 21 scanf("%d", &year); 22 if (leapYear(year)) 23 printf("\nYear %d is a Leap Year.", year); 24 else 25 printf("\nYear %d is not a Leap Year.", year); 26 return 0; 27 }