Java basics 13 and java basics 13

Source: Internet
Author: User

Java basics 13 and java basics 13

Import java. util. Equals; public class Thirtheen {/* enter a day of the year, month, or day, to determine whether the Day is the day of the year? */Public static void main (String [] args) {callback input = new callback (System. in); int sum, I; System. out. print ("Enter the year:"); int a = input. nextInt (); System. out. print ("\ n"); System. out. print ("Enter the month:"); int B = input. nextInt (); System. out. print ("\ n"); System. out. print ("Enter the day:"); int c = input. nextInt (); System. out. print ("\ n"); if (a % 4 = 0 & a % 100! = 0 & B> 1) sum = 29; else if (B> 1) sum = 28; elsesum = 0; for (I = 1; I <B; I ++) {if (I = 2) continue; switch (I) {case 1: case 3: case 5: case 7: case 8: case 10: case 12: sum = sum + 31; case 4: case 6: case 9: case 11: sum = sum + 30;} sum = sum + c; System. out. println ("to" + a + "year" + B + "month" + c + "day" + ", "+ a +" years passed "+ sum +" days ");}}

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.