Prerequisite:
Leap Year:
if (a year is divisible by 4) then (it is a leap year)
else (it is a Non-leap year)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#include<stdio.h> int main() { unsigned int year; printf("\n Program to check Whether Year is leap or not"); printf("\nPlease enter any Year: "); scanf("%u",&year); if(year%4==0) { printf("\nYear %u is a leap year",year); } else { printf("\nYear %u is a Non-leap year",year); } return 0; } |
1 2 3 4 5 |
Output: Program to check Whether Year is leap or not Please enter any Year: Year 2400 is a leap year |