what is the Armstrong program
Answers
Answered by
0
Answer:
he went space and improve our knowledge
Answered by
0
Armstrong Program
Explanation:
An armstrong number is that number which is equal to the total of the actual numbers of its cubes.
For Example:
Program form Python:
#get input from the user
n = int(input("Enter a number: "))
# initialize the variable to 0
s = 0
#initialize the input in other variable
alt = n
#set loop when n is 0
#then loop stop
while(alt > 0):
rem = alt % 10
s += rem ** 3
alt //= 10
# display the result
if(n == s):
print(n,"is an Armstrong number")
else:
print(n,"is not an Armstrong number")
Following are the description of the program:
- Set a variable 'n' that get input from the user.
- Set a variable 's' and initialize to 0.
- Set the while loop iterates and stop when the variable 'n' is 0 then, set the following logics for armstrong.
- Finally, set if-else statement to check that the following number is armstrong or not.
Learn More:
brainly.in/question/10352835
Similar questions