Thread: How can I do this program?

1. Member Join Date
Nov 2010
Posts
1
Rep Power
0 How can I do this program?

Write a program that will find all the three digit natural numbers that are equal to the sum of the cubes of their digits. Maximum 3 digit number is 999. What is the first?  Reply With Quote

2. To multiply all digits divide the number by ten and store the leftover in another variable (by using the % operator). Then divide the left number by ten again and so on.  Reply With Quote

3.  Originally Posted by Sorena Write a program that will find all the three digit natural numbers that are equal to the sum of the cubes of their digits. Maximum 3 digit number is 999. What is the first?
153; do you really lack the imagination to come up with the condition:

Java Code:
if (100*a+10*b+c == a*a*a+b*b*b+c*c*c)
in a triple nested loop for values of a in [1,9] and values of b and c in [0,9];
... if so, programming is not for you.

kind regards,

Jos  Reply With Quote

4. Senior Member Join Date
Feb 2010
Location
Waterford, Ireland
Posts
748
Rep Power
10 I hope this was a mathematic course....  Reply With Quote Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•