Below is the program to check whether the entered number is Armstrong or not.


num = int(input("Enter Your Number: "))
sum = 0

temp = num # store value to compare later on 
while temp > 0:
   digit = temp % 10
   sum =sum + digit ** 3
   temp =temp // 10

if num == sum:
   print("Congrats !! "+str(num)+" is an Armstrong number.")
else:
   print("Oops !!"+str(num)+"is not an Armstrong number")
image 15 - https://codeconfig.in

Output:

image 16 - https://codeconfig.in
image 17 - https://codeconfig.in

Comments are closed.

Explore More

AI Roadmap using Python

Python is a great foundation for diving into AI! To take the next step in your AI learning journey, here’s a roadmap to guide you. 1. Strengthen Your Math Skills

Explain about Hugging Face Transformers

Hugging Face Transformers is a powerful library designed for natural language processing (NLP), computer vision, and audio tasks. It provides state-of-the-art pretrained models and tools for fine-tuning and deploying these

What are Large Language Models

LLM stands for Large Language Model in the context of artificial intelligence. It refers to a type of AI model designed to understand, generate, and manipulate human language on a