Python Program Checks Armstrong Numbers with Loops and Math

Greetings everyone! 👋 Today I worked on a Python program to check whether a number is an Armstrong number. This was a great exercise to strengthen my understanding of loops, mathematical operations, and number manipulation logic in Python. 🔹 What the Program Does: The program takes a number as input from the user and checks if it is an Armstrong number. An Armstrong number is a number where the sum of its digits raised to the power of the total number of digits is equal to the number itself. 🔹 How the Logic Works: • The program first takes user input. • It calculates the number of digits using string conversion. • Using a while loop, it extracts each digit. • Each digit is raised to the power of the total number of digits. • The results are added and compared with the original number. 🔹 Example Outputs: ✔ 153 → Armstrong Number ❌ 54 → Not an Armstrong Number 🔹 What I Learned: • Practical use of loops and conditions • Mathematical logic implementation in Python • Working with numbers and digit extraction • Writing clean and simple algorithm-based programs This small project helped me improve my problem-solving skills and strengthened my programming fundamentals. Harish M #Python #Programming #LearningJourney #Coding #DataAnalytics #PythonBasics

  • text

To view or add a comment, sign in

Explore content categories