write a program to enter a number and check whether the
number is an Armstrong number or not.
A number is said to be an Armstrong number if the sum of the
cubes of its digits is equal to the original number.
Answers
Answer:
hello,
its using python
Explanation:
# program to enter a number and check whether the number is an Armstrong number or not.
n=int(input("enter the number"))
a=n
sum=0
while n>0:
r=n%10
sum=sum+(r**3)
n=n//10
if sum==a:
print(n,"is an armstrong number")
else:
print(n,"is not an armstrong number")
_______________________
hope it helps you
please mark brainliest
@ItzSnowySecret07
An Armstrong number is a number whose sum of cubes of digits is equal to the number itself.
For example:
153 = 1³+5³+3³
1+125+27
=153
Program:
import java. util.*;
class Armstrong
{
public static void main (string args [])
{
Scanner sc = new Scanner
int n, r, p, s=0, m;
System.out.println ("Enter a number");
n=sc.nextInt();
while
{
r=n%10
p=r*r*r;
s=s+p;
n=n/10;
}
if (m==s)
System.out.println (m+"is Armstrong");
else
System.out.println (m+"is not Armstrong");
}
}