Displaying Source Code(s)
|
|
PROGRAM TO FIND WHETHER A GIVEN YEAR IS LEAP YEAR OR NOT.
--------------------------------------------------------------------------------
#include <stdio.h>
#include <conio.h>
void main()
{
int year,leap;
clrscr();
printf("enter the year:- ");
scanf("%d",&year);
if ((year%100)==0)
leap=(year/400)*400;
else
leap=(year/4)*4;
if (leap==year)
printf("
%d is a leap year.",year);
else
printf("
%d is not a leap year.",year);
getch();
}
|
|
|