About Lesson
Create a program that checks if a given year is a leap year or not.
#include <stdio.h>
int main() {
// Declare variables
int year;// Input: Get the year from the user
printf(“Enter a year: “);
scanf(“%d”, &year);// Process: Check if the year is a leap year
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
printf(“%d is a leap year.n”, year);
} else {
printf(“%d is not a leap year.n”, year);
}return 0; // Exit the program successfully
}