**New course!**Every coder should learn

**Generative AI!**

+ 2

# what are armstrong numbers??

2 Answers

+ 6

Armstrong Numbers are three digit numbers whose sum of cubes of Individual digits is equal to the number itself.
say for e.g. 135
1^3+3^3+5^3= 135.
So it's an Armstrong Number.
If you wanted the logic to know whether a number is Armstrong or not then:
.
.
.
//where x is the number to be checked
int th=x/100;
int hu=(x%100)/10;
int one=x%10;
int sum=th^3+hu^3+one^3;
if (sum==x)
cout<<"Number is Armstrong Number";
...

+ 1

Armstrong Numbers need not be a three digit number.
ex: for any number
number=(first digit)^number of digits+.......