Software Testing week fourth--illegal input processing for leap year issues

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.