Leap Year

Monday, 29 August 2011

#include<stdio.h>
#include<conio.h>
void main()
{
int year,t1,t2;
clrscr();

printf("enter any year\n");
scanf("%d",&year);

t1=(year%100==0)&&(year%400==0);
t2=(year%100!=0)&&(year%4==0);

if(t1||t2)
  {
  printf("leap year\n");
  }
else
  {
  printf("not a leap year");
  }

getch();
}


OUTPUT:

enter any year
2004
leap yea
r



No comments:

Post a Comment

 

Blogger news

Blogroll

Enter your email address:

Delivered by FeedBurner

Total Pageviews

Followers

Most Reading