Java Blue Bridge Cup--basic exercise (7) Special palindrome number

Source: Internet
Author: User

Keywords:

Palindrome number Loop Condition statement 2



Topic:

Workaround:

1  PackageCom.algorithm.java.blueBirdge;2 3 ImportJava.util.Scanner;4 5  Public classPaliindrome2 {6      Public Static voidMain (string[] args) {7Scanner Read =NewScanner (system.in);8         intsum =read.nextint ();9         //int sum=0;Ten          for(inti=10000;i<=999999;i++){ One             if(i>=10000 && i<=99999) { A                 //Digit -                 intGewei5=i% 10; -                 //10 Guests the                 intshiwei5= (i% 100)/10; -                 //Hundred -                 intbaiwei5= (i/100)%10; -                 //thousand +                 intqianwei5= (i/1000)% 10; -                 //million-bit +                 intwanwei5=i/10000; A                 //output such a five-digit number at                 if(gewei5== wanwei5 && (shiwei5) = = (QIANWEI5) && (gewei5+shiwei5+baiwei5+qianwei5+wanwei5==sum))) { -                     //if () { - System.out.println (i); -                     //} -  -                 } in             } -  to             //output such a six-digit 999 999 +             Else{ -                 //Digit the                 intGewei6=i% 10; *                 //10 Guests $                 intshiwei6= (i% 100)/10;Panax Notoginseng                 //Hundred -                 intbaiwei6= (i%1000)/100; the                 //thousand +                 intqianwei6= (i/1000)%10; A                 //million-bit the                 intwanwei6= (i/10000)% 10; +                 //100,000 guests -                 intshiwanwei6=i/100000; $  $                 if(Gewei6 = = Shiwanwei6 && ((shiwei6) = = (Wanwei6)) && (baiwei6) ==qianwei6) && (gewei6+shiwei6+ baiwei6+qianwei6+wanwei6+shiwanwei6==sum)) { -                     //if () { - System.out.println (i); the                     //} - Wuyi                 } the             } -         } Wu     } -}

Java Blue Bridge Cup--basic exercise (7) Special palindrome number

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.