Q. write a c program to find is the given year is Leap year or not.
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("Enter any year: ");
scanf("%d",&a);
if(((a%4==0)&&(a%100!=0))||(a%400==0))
{
printf("\n%d is a leap year",a);
}
else
{
printf("\n%d is not a leap year",a);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("Enter any year: ");
scanf("%d",&a);
if(((a%4==0)&&(a%100!=0))||(a%400==0))
{
printf("\n%d is a leap year",a);
}
else
{
printf("\n%d is not a leap year",a);
}
getch();
}
No comments:
Post a Comment