Monday, 6 July 2015

Write C Program To Check inputed Number is Leap Year Or Not

1:  int main()  
2:  {  
3:   int year;  
4:   printf("Enter a year to check if it is a leap year<span style="font-weight: bold;">\n</span>");  
5:   if ( year%400 == 0)  
6:    printf("%d is a leap year.", year);  
7:   else if ( year%100 == 0)  
8:    printf("%d is not a leap year.", year);  
9:   else if ( year%4 == 0 )  
10:    printf("%d is a leap year", year);  
11:   else  
12:    printf("%d is not a leap year.", year);   
13:   return 0;  
14:  }  

No comments:

Post a Comment