Computer Science, asked by smaty991, 3 months ago

armstorng number program variables

Answers

Answered by Anonymous
1

Answer:

hello,

its using python

Explanation:

_________________________________________________________

Armstrong Numbers:

An Armstrong number is a number such that the sum of its cube of its digits is equal to the number itself.

__________________________________________________________

#program to find whether a given number is armstrong or not

n=int(input("enter the number"))

a=n

sum=0

while n>0:

   r=n%10

   sum=sum+r**3

   n=n//10

if sum==a:

   print("its an armstrong number")

else:

   print("its not an armstrong number")

__________________________________________________________

#program to generate armstrong numbers

n=int(input("enter the range"))

for i in range(1,n+1):

   n=i

   sum=0

   while n>0:

       r=n%10

       sum=sum+r**3

       n=n//10

   if sum==i:

       print(i,end=",")

__________________________________________________________

hope it helps you

please mark brainliest

@ItzSnowySecret07

Similar questions