/*
* 1000+ C programs + tutorials
*
*
* 41_Check_entered_year_is_a_leapyear.c
*
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include
//#include
void main() {
int year;
//clrscr();
printf("C Program to Find Entered Year is a leap year or not.");
printf("\n\n Enter Number : ");
scanf("%i", &year);
//Logic to check leap year
if ((year % 400 == 0) || ( ( year % 100 != 0) && (year % 4 == 0 ))) {
printf("\n\n %i is a leap year!",year);
}
else {
printf("\n\n %i is not a leap year!!",year);
}
//getch();
}
-
Output :
C Program to Find Entered Year is a leap year or not.
Enter Number : 2014
2014 is not a leap year!!
C Program to Find Entered Year is a leap year or not.
Enter Number : 1900
1900 is not a leap year!!
C Program to Find Entered Year is a leap year or not.
Enter Number : 2000
2000 is a leap year!!
C Program to Find Entered Year is a leap year or not.
Enter Number : 2016
2016 is a leap year!!
The best way to learn C programming is to practice more and more of programs .
Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.
BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.