![]() |
Armstrong number check
To check whether entered number is armstrong number or not.
Code: C
|
Re: Armstrong number check
You are printing the wrong output.
Code:
if(sum==n1)Armstrong number: An n-digit number equal to the sum of the nth powers of its digits. There are no two-digit Armstrong numbers; and there are four three-digit Armstrong numbers: 153, 370, 371, and 407. 1x1x1 + 5x5x5 + 3x3x3 = 153 |
Re: Armstrong number check
I have read the above program and try to understand it but i cannot understand all. I only can calculate the 53 without the 1 and 370 without the 3. I don't know why. Your explanations is greatly appreciated by me and others.
n=n/10; -- Is it the 153 calculate 3 first, then 5 and finally 1. Sorry for my stupidness. Your help is greatly appreciated by me an others. |
Re: Armstrong number check
Thanks for your help.
|
| All times are GMT +5.5. The time now is 21:43. |