Chapter - 3: The Decision Control

Any year is entered through the keyboard, write a program to determine whether the year is a leap or not. Use the logical operators && and ||.


G
Sections
1
Exercises
#include<stdio.h>
#include<conio.h>
int main()
{
	int yer;
	
	printf("Enter a year : ");
	scanf("%d", &yer);
	
	if( ((yer % 4) && 1) == 0 )
		printf("\n\n%d is a leap year", yer);
		
	if( ((yer % 4) || 0) == 1 ) 
		printf("\n\n%d is not a leap year", yer);
	
	getch();
	return 0;
}

© 2021 Garbage Valuegarbage value logo