Chapter - 3: The Decision Control

Any year is input through the keyboard. Write a program to determine whether the year is a leap year or not. (Hint: Use the % (modulus) operator).


C
Sections
3
Exercises

A

B

C

D

E

F

G

H

I

J

K

1

2

3

4

5

6

7

8

9

10

11

12

#include<stdio.h>
#include<conio.h>
int main()
{
	int year;
	
	printf("Enter an year : ");
	scanf("%d", &year);
	
	if(year%4 != 0)//not a leap year
		printf("\n\n%d is not a leap ", year);
	else//leap year
		printf("\n\n%d is a leap year.", year);
		
	getch();
	return 0;
}

© 2020 Garbage Valuegarbage value logo