- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to generate armstrong numbers in Python?
Any three digit number is called an Armstrong number of sum of cube of its digits equals the number itself. In order to check if a number satisfies this condition, each digit from it is successively separated from right and its cube is cumulatively added. In the end if the sum is found to be equal to original number, it is called Armstrong number.
Following Python code prints all armstrong numbers between 100 to 999
for num in range(100,1000): temp=num sum=0 while temp>0: digit=temp%10 sum=sum+digit**3 temp=temp//10 if sum==num: print (num)
The output is list of armstrong numbers
153 370 371 407
- How to print Narcissistic(Armstrong) Numbers with Python?
- How to generate prime numbers using Python?
- How does Python generate random numbers?
- Armstrong Numbers between two integers?
- C Program for Armstrong Numbers
- How to generate pyramid of numbers using Python?
- How to generate non-repeating random numbers in Python?
- How to use Python Numpy to generate Random Numbers?
- How can we generate Strong numbers in Python?
- Generate pseudo-random numbers in Python
- Java program to print the Armstrong numbers between two numbers
- Armstrong Number in Python
- Python module to Generate secure random numbers
- Write a program in Python to filter armstrong numbers in a given series