Chapter - 3: The Decision Control

Write a program using conditional operators to determine whether a year entered through the keyboard is a leap year or not.


K
Sections
2
Exercises

A

B

C

D

E

F

G

H

I

J

K

1

2

3

#include<stdio.h>
#include<conio.h>
int main()
{
	int yer;
	
	printf("Enter a year : ");
	scanf("%d", &yer);
	
	yer % 4 ? printf("%d is a not a leap year.", yer):printf("%d is a leap year.", yer);
	
	getch();
	return 0;
}

© 2020 Garbage Valuegarbage value logo