prev


Implicit if

23. Leap year or not (3.7.2009)

/*
Program# 23
date : 25-12-2008
Leap Year or not
*/

#include <stdio.h>
main(){
int n,x;
printf("\nEnter a year :");
scanf("%d",&n);
x=n%4;
if(x)
printf("\n%d : Not Leap Year\n",n);
else
printf("\n%d : Leap Year\n",n);
}

output:
Enter a year : 1985
1985 : Not Leap Year

Things to note:
Any value other than 0 is considered as true.

next
blog comments powered by Disqus