img
Question:
Published on: 21 November, 2024

Write a C program to check a year is leap year or not.

Answer:
#include <stdio.h>
#include <conio.h>

main()
{
	int y;
	printf("\n enter any year");
	scanf("%d", &y);
	if ((y % 4 == 0) && ((y % 100 != 0) || (y % 400 == 0)))
		printf("\n the year is LEAPYEAR");
	else
		printf("\n the year is NOT LEAPYEAR");
	getch();
}

Output:

Random questions