armstrong number using while loop

armstrong number:-   Armstrong numbers are those numbers which when added to the cube of their own value, the same value is obtained, it is called armstrong number.

"आर्मस्ट्रांग नंबर वे नंबर होते हैं जो अपनी ही वैल्यू का क्यूब करके जोड़ने पे वही वैल्यू प्राप्त होती है armstrong number कहलाते हैं l  "

जैसे : (1)3+(5)3+(3)3 = 153

        1+125+27 = 153

# print armstrong number using while loop

print("Armstrong Number")

x=int(input("enter any value:="))

y=x

s=0

while (x!=0):

    z=x%10

    s=s+z*z*z

    x=x//10

if (s==y):

    print("Armstrong Number")

else:

    print("Not Armstrong Number")

    

    

 

0 تعليقات

إرسال تعليق

Post a Comment (0)

أحدث أقدم