sahajjain01

E3.Input a year & check if it's a leap year.

Sep 2nd, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. //Program to input a year and check if it's a leap year.
  2. #include<stdio.h>
  3. #include<conio.h>
  4.  
  5. void main()
  6. {
  7.     int year;
  8.    
  9.     clrscr();
  10.    
  11.     printf("Enter a year: ");
  12.     scanf("%d", &year);
  13.  
  14.     if(year % 400 == 0)
  15.         printf("The year %d is a leap year", year);
  16.     else if(year % 100 == 0)
  17.         printf("The year %d is not a leap year", year);
  18.     else if(year % 4 == 0)
  19.         printf("The year %d is a leap year", year);
  20.     else
  21.         printf("The year %d is not a leap year", year);
  22.  
  23.     getch();
  24. }
Advertisement
Add Comment
Please, Sign In to add comment