Skip to content
Menu
O Level Mock Test
  • O Level Python PR3 Practical Live Class | M3-R5.1 Programming and Problem Solving Through Python (M3-R5) 
O Level Mock Test

Write a program to print all Armstrong numbers in a given range. Note: An Armstrong number is a number whose sum of cubes of digits is equal to the number itself. E.g. 370=33+73+03

start=int(input(“Enter the start value”))

stop=int(input(“enter the stop Value”))

for num in range(start,stop+1,1):

    temp=num

    sum=0

    while(temp>0):

        digit=temp%10

        sum=sum+digit*digit*digit

        temp=temp//10

    if sum==num:

        print(num)

Categories

  • Business
  • Education
  • Life Fun
  • Technology

Follow Us

Follow us on Facebook Subscribe us on Youtube Follow us on Instagram Contact us on WhatsApp

Recent Posts

  • CCC-8
  • Here are 10 points that you can follow to protect your job from being taken over by AI:
  • What is the Future of Ai
  • Latest or Future Education Trends
  • Best career options in 2023

Categories

  • Business
  • Education
  • Life Fun
  • Technology

Archives

  • November 2024
  • April 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • June 2022
©2026 O Level Mock Test | Powered by WordPress and Superb Themes!