Ad

Chapter - 6: Functions And Pointers

Any year is entered through the keyboard. Write a function to determine whether the year is a leap year or not.


Ad
D
Sections
4
Exercises
#include<stdio.h>
#include<conio.h>

void find(int);

int main()
{
	int yr;
	printf("Enter a year : ");
	scanf("%d", &yr);
	find(yr);
	getch();
	return 0;
}

void find(int yer)
{
	if (yer % 4)
		printf("%d is not a leap year.", yer);
	else
		printf("%d is a leap year.", yer);
}
Ad

© 2024 Garbage Valuegarbage value logo