Leap Year Judgment method:
1. Years that can be divisible by 400;
2. Year that can be divisible by 4 but not divisible by 100 at the same time.
A leap year is one that satisfies either of these conditions.
Here are three different forms
The procedure is as follows:
One:
#include < stdio . h >
int Main ()
{
int =
for (M = <= ++ )
{if (M % == 0)
{if (M % == 0)
{if(M%= =0)
N = 1;
Else n=0;
}
Else n=1;
}
else =
if(n) printf ("%d", M,count+ +);
}
if % == 0) printf ( );p rintf ( "\ncount=%d" ,count);
return 0;
}
Two:
#include < stdio . h >
int Main ()
{
int m,n,count=0;
for (M = <= ++ )
{if (M % == 0)
{if (M % != 0) printf ( "%d " ++ );
if (M % == 0)
printf ("%d", M,count+ +);
}printf ("\ncount=%d", count);
return 0;
}
Three:
#include < stdio . h >
int Main ()
{
int m,count=0;
for(m=1000;m<=2000;m+ +)
{
if(M%4==0&&m% -!=0||m% -==0) printf ("%d", M,count++);
}
printf ("\ncount=%d", count);
return 0;
}
This is known as the "four Years a leap, a century does not leap, 400 years to leap" Leap year algorithm program. But for a large number of years, if the year can be divisible by 3200, and divisible by 172800 is a leap, this program is not considered.
This article is from the "Materfer" blog, make sure to keep this source http://10741357.blog.51cto.com/10731357/1698504
C-language printing leap year 1000--2000