লিপ ইয়ার হলো ৩৬৬ দিনের বছর। প্রতি ৪ বছর পর একটি লিপ ইয়ার আসে।
লজিক
if ((year%400 == 0) || ((year%4 == 0) && (year%100 != 0)))
// Leap Year
else
// Not Leap Year
উদাহরণ প্রোগ্রাম
#include <stdio.h>
int main() {
int year;
printf("Enter any year you wish \n");
scanf(" %d ", &year);
if ((year%400 == 0) || ((year%4 == 0) && (year%100 != 0)))
printf("\n %d is a Leap Year. \n", year);
else
printf("\n %d is not the Leap Year. \n", year);
return 0;
}
আউটপুট
Enter any year you wish 2045 2045 is not the Leap Year.