Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program to input a year and check if it's a leap year.
- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- int year;
- clrscr();
- printf("Enter a year: ");
- scanf("%d", &year);
- if(year % 400 == 0)
- printf("The year %d is a leap year", year);
- else if(year % 100 == 0)
- printf("The year %d is not a leap year", year);
- else if(year % 4 == 0)
- printf("The year %d is a leap year", year);
- else
- printf("The year %d is not a leap year", year);
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment