Ad

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.


Ad
K
Sections
2
Exercises
#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;
}
Ad

© 2024 Garbage Valuegarbage value logo