Enter month day, output this day is how many days of this year

Source: Internet
Author: User

  while(true) {Console.Write ("Please enter the year:"); intA =int.                Parse (Console.ReadLine ()); Console.Write ("Please enter the month:"); intb =int.                Parse (Console.ReadLine ()); Console.Write ("Please enter the date:"); intc =int.                Parse (Console.ReadLine ()); intD; if(A >9999|| A <1759|| b <=0|| B > A|| C <=0|| C > to|| (b = =4|| b = =6|| b = =9|| b = = One) && C > -) {Console.WriteLine ("the date you entered is incorrect"); }                Else                {                    ifA -==0|| A -!=0&& A%4==0))                    {                        if(b <2) {D=C; Console.WriteLine ("This is the first year of the"+ D +"days"); }                        if(b = =2)                        {                            if(C > in) {Console.WriteLine ("the date you entered is incorrect"); }                            Else{d= C + to; Console.WriteLine ("This is the first year of the"+ D +"days"); }                        }                        if(B >2&& B <8)                        {                            if(b%2==0) {D= b/2* to+ (b/2-2) * -+ in+C; Console.WriteLine ("This is the first year of the"+ D +"days"); }                            if(b%2!=0) {D= (b-1) /2* to+ ((b-1) /2-1) * -+ in+C; Console.WriteLine ("This is the first year of the"+ D +"days"); }                        }                        if(b >=8)                        {                            if(b%2==0) {D= (b-8) /2* to+ (b-8) /2* -+ to*4+ -*2+ in+C; Console.WriteLine ("This is the first year of the"+ D +"days"); }                            Else{d= (b-7) /2* to+ ((b-7) /2-1) * -+ to*4+ -*2+ in+C; Console.WriteLine ("This is the first year of the"+ D +"days"); }                        }                    }                    Else                    {                        if(b <2) {D=C; Console.WriteLine ("This is the first year of the"+ D +"days"); }                        if(b = =2)                        {                            if(C > -) {Console.WriteLine ("the date you entered is incorrect"); }                            Else{d= C + to; Console.WriteLine ("This is the first year of the"+ D +"days"); }                        }                        if(B >2&& B <8)                        {                            if(b%2==0) {D= b/2* to+ (b/2-2) * -+ -+C; Console.WriteLine ("This is the first year of the"+ D +"days"); }                            Else{d= (b-1) /2* to+ ((b-1) /2-1) * -+ -+C; Console.WriteLine ("This is the first year of the"+ D +"days"); }                        }                        if(b >=8)                        {                            if(b%2==0) {D= (b-8) /2* to+ ((b-8) /2) * -+ to*4+ -+ -*2+C; Console.WriteLine ("This is the first year of the", C +"days"); }                            Else{d= (b-7) /2* to+ ((b-7) /2-1) * -+ to*4+ -+ -*2+C; Console.WriteLine ("This is the first year of the"+ D +"days"); }                        }                    }                }            }

Enter month and date, and how many days of the year is the output of this day

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.