Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 10. The Leap of Year
- Welcome to Calendars Inc.! As you can already tell, our company is involved in the production of calendars every year. We are in need of a program that would change the landscape of calendar-making forever! Your job is to make a program that would determine whether the year we inputted is a leap year or not.
- A year is considered a leap year when it is either:
- (a) divisible by 4, but not 100 or
- (b) divisible by both 4, 100, and 400 at the same time
- Inputs
- 1. The year
- */
- #include <stdio.h>
- int main(){
- int year;
- printf("Enter the year: ");
- scanf("%d", &year);
- if (year % 4 == 0 && year % 100 == 0 && year % 400 == 0){
- printf("%d is a leap year", year);
- }
- else if (year % 4 == 0 && year % 100 != 0){
- printf("%d is a leap year", year);
- }
- else {
- printf("%d is not a leap year", year);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement