Home
User Guide
DB Recovery
Download
Documents
FAQ
Books
About Me
C Programs
Stats

/* Program# 51
   date : 28-12-2008
   while loop-"Leap year or not" between given range
*/

#include <stdio.h>
main(){
int a,b,c=0;
printf("\nEnter two years :");
scanf("%d %d",&a,&b);
while(a<=b){
c=a%4;
if(!c)
printf("\n Leap year:%d",a);
else
printf("\n Not Leap year:%d",a);
a=a+1;
}
}



output:
To compile the program, run the gcc command,
$ gcc p51.c  
Now the executable file is stored as a.out, to run
the program,

$ ./a.out

Enter two years :2000 2009

 Leap year:2000
 Not Leap year:2001
 Not Leap year:2002
 Not Leap year:2003
 Leap year:2004
 Not Leap year:2005
 Not Leap year:2006
 Not Leap year:2007
 Leap year:2008
 Not Leap year:2009
$ 






Powered by
Open Source Programmers