subject

So far we have worked on obtaining individual digits from 4 digits of 5 digit numbers. The added them to find the sum of digits. However, now we know about the loop and we can remove the limit of having a specific number of digits. Write a program to print out all Armstrong numbers between 1 and n where n will be an user input. If the sum of cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number. For example, 153 = (1 * 1* 1)+ ( 5 * 5* 5 ) + ( 3*3*3) In order to solve this problem we will implement the following function: sumDigitCube(): write a function sumDigitCube() that takes a positive integer as a parameter and returns the sum of cube of each digit of the number. Then in the main function, take an integer n as input and generate each number from 1 to n and call the sumDigitCube() function. Based on the returned result, compares it with the value of the generated number and take a decision and print the number if it is Armstrong number

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 05:20, reeeeeee32
What did creator markus “notch" persson initially call his game
Answers: 1
image
Computers and Technology, 23.06.2019 12:20, jshhs
When guido van rossum created python, he wanted to make a language that was more than other programming languages. a. code-based b. human-readable c. complex d. functional
Answers: 1
image
Computers and Technology, 24.06.2019 07:00, sudotoxic
Into what form does the barcode reader convert individual bar patterns?
Answers: 1
image
Computers and Technology, 24.06.2019 13:30, lorelaistudent
Does anybody know how to hack into a google account? i had important information on it and it is gone now and i need getting it back.
Answers: 1
You know the right answer?
So far we have worked on obtaining individual digits from 4 digits of 5 digit numbers. The added the...

Questions in other subjects:

Konu
Mathematics, 11.11.2020 16:20
Konu
Mathematics, 11.11.2020 16:20
Konu
Mathematics, 11.11.2020 16:20