C PROGRAM TO CHECK WHETHER A GIVEN YEAR IS A LEAP YEAR OR NOT

 

  1. #include<stdio.h>  
  2. #include<conio.h>  
  3. void main() {  
  4.     int year;  
  5.     printf("Enter a year: ");  
  6.     scanf("%d", &year);  
  7.     if(((year%4==0) && ((year%400==0) || (year%100!==0))  
  8.     {  
  9.         printf("%d is a leap year", &year);  
  10.     } else {  
  11.         printf("%d is not a leap year", &year);  
  12.     }  
  13.     getch();  
  14. }  

Comments

Popular posts from this blog