Computer Science, asked by Anonymous, 5 months ago

Write a program to input a number and check whether its an Armstrong number or not . If the sum of the cube of the digit is equal to the number is known as Armstrong number
Eg-153=13+53+33 =153

Don't spam❌❌❌​

Answers

Answered by Anonymous
9

Answer:

hope it help u siso....

Explanation:

A positive integer is called an Armstrong number of order n if

abcd... = an + bn + cn + dn + ...

In case of an Armstrong number of 3 digits, the sum of cubes of each digit is equal to the number itself. For example:

153 = 1*1*1 + 5*5*5 + 3*3*3 // 153 is an Armstrong number.

Source Code: Check Armstrong number (for 3 digits)

# Python program to check if the number is an Armstrong number or not

# take input from the user

num = int(input("Enter a number: "))

# initialize sum

sum = 0

# find the sum of the cube of each digit

temp = num

while temp > 0:

digit = temp % 10

sum += digit ** 3

temp //= 10

# display the result

if num == sum:

print(num,"is an Armstrong number")

else:

print(num,"is not an Armstrong number")

Answered by aasthadessai
1

Answer:

yes of course the ans is definitely 153

Similar questions