How to fetch values from each bit of data in Java

Source: Internet
Author: User
/
Thought: Take the values on each bit of the data
Requirements: Output All "daffodils" on the console
Analysis:
The so-called Narcissus number refers to a three-digit number whose numbers are cubic and equal to the number itself
Like what:
153=1
11 + 555 + 333
/
Class fordemo4{
public static void Main (string[] args) {
for (int x = 100;x<=999;x++) {
int GE = x%10; To take a single digit number, use that number to 10.
int shi=x/10%10; To take a number 10 digits, divide the number first by 10, move the original 10 digits to the digit, and then take the remainder to 10
int bai=x/100%10; And in the same vein
if (x = = (GEgege+shishishi+baibaibai)) {
SYSTEM.OUT.PRINTLN (x);

        }    

}

How to fetch values from each bit of data in Java

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.