prev


Implicit if

25. Leap year or not (Logical NOT) (5.7.2009)

/*
Program# 25
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 : Leap Year\n",n);
else
printf("\n%d : Not Leap Year\n",n);
}

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

next
blog comments powered by Disqus