Saturday, 11 April 2015

Leap Year or Not!

Any year is input through the keyboard. Write a program to determine where the year is leap year or not. (Hint: Use the % (modulus) operator)


Code

void main(){
int var1,vLyear;
clrscr();
printf("Enter a year: ");
scanf("%d",&var1);
vLyear = var1%4;
if(vLyear==0)
printf("Its Leap Year!   %d",var1);
else
printf("Its not Leap Year!   %d",var1);
getch();
}



Output






No comments:

Post a Comment