Write a program using while loop that can read an integer


Write a program using while loop that can read an integer number and determines whether the sum of the cubes of the digits is equals to the number itself. display a message indicating whether the sum of the cubes is equal or not equal to the number.

For example, if the number 563 is entered as input, the sum of the cubes of the digits is 5^3 + 6^3 + 3^3 = 125+ 216 +27 = 368 which is not equal to 563.

On the other hand, if the number 371 is entered as input, the sum of the cubes of the digits is 3^3 + 7^3 + 1^3 = 27 + 343 + 1 = 371 which equal to 371. The program will be repeated until input number is equal to the sum of the cubes.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Write a program using while loop that can read an integer
Reference No:- TGS01384913

Now Priced at $20 (50% Discount)

Recommended (91%)

Rated (4.3/5)