![]() ![]() The process of finding out whether the 4-digit number is an Armstrong number or not is pretty simple. ![]() How do I find my 4 digit Armstrong number? What is the Armstrong 4 digit number?Ī four-digit armstrong number python is a number when the sum of each individual digit raised to the power of 4 is equal to the number itself. Whereas, if the sum is not equal to the original number, the number is not an Armstrong number. Lastly, if the sum is equal to the original number, we can say that the number is an Armstrong number. ![]() After this step we take the cubes of the digits using the exponent operator. When the remainder of the number is then divided by 10, we achieve the last digit of the original number. Using the % operator we obtain each digit of the number. Firstly, we initialize the value of sum ‘s’ as 0. In the above program, the sum of the cube of each digit as we considered a three digit number. Copy Code Copied Use a different Browser n = int(input("Enter a number: ")) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |