Judging conditions for leap years:
①, ordinary year can be divisible by 4 and cannot be divisible by 100 for leap years.
A leap year in which ② can be divisible by 400
③, for a large number of years, if the year can be divisible by 3200, and divisible by 172800 is a leap. such as 172,800 years is a leap year, 86,400 years is not a leap
Test Case:
Number |
Input |
Output |
1 |
2004 |
This is a leap year |
2 |
2008 |
This is a leap year |
3 |
2000 |
This is a leap year |
4 |
1999 |
Non-leap years for this year |
5 |
1998 |
Non-leap years for this year |
6 |
-1200 |
Illegal input |
Basic logic:
#include <stdio.h>
void Main ()
{
int year,a;
printf ("Please enter the Year:");
scanf ("%d", &year);
A=1;
else if (year<0)
a=2;
a=0;
if (a==1)
printf ("\n%d This is a leap year \ n";
else if (a==0)
printf ("%d years non-leap year \ n";
Else
printf ("%d input illegal \ n");
}
Software Testing week fourth--illegal input processing for leap year issues