2.43 loop structure for statement practice palindrome number

Source: Internet
Author: User

/* Exercise: In the console output meet the following conditions of five digits equal to the million bit 10 bits equals thousands digit + 10 bit + thousand + million bit = Hundred Analysis: A: Five digits is the range B: decomposition of each five-digit number, 10, hundred, thousand, the data c: according to the requirements of the judgment can be */class ForDemo7 {public static void main (string[] args) {//Five digits tells us the range. for (int x = 10000; x < 100000; + +) {//decomposition of each five-digit, 10, hundred, thousand, million-digit data int ge = x% 10;int shi = x/10% 10;int Bai = X/10 /10;int Qian = x/10/10/10% 10;int wan = x/10/10/10/10% 10;//be judged as required if ((ge = = WAN) && (s hi = = Qian) && (ge + shi + qian + wan = = Bai)) {System.out.println (x);}}}


2.43 loop structure for statement practice 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.