welcome to mech - b class in c for all website for pdf and .docx download
Monday, September 29, 2014
Write a C Program to check entered year is a leap year or not.
#include<stdio.h>
#include<conio.h>
void
main()
{
int year;
printf("Enter a year:");
scanf("%d", &year);
if(year%4 == 0)
printf("\n
This is a leap year.", year);
else if (year%400 == 0)
printf("\n
This is a leap year.", year);
else if(year%100 == 0)
printf("\n
This is not a leap year.", year);
else
printf("\n
This is not a leap year.", year);
getch();
}
OUTPUT:
Enter a year: 12
This is a leap year.
Subscribe to:
Posts (Atom)