Posted By:
7 Aug, 2013 1:14 pm PDT

Armstrong number in C

How to find whether a number is Armstrong in C programming?
Attachment:None


A number is armstrong if the sum of cubes of individual digits of a number is equal to the number itself.

-An example of an armstrong number is 370

=>370; 3^3+7^3+0^3 = 27+ 343 + 0 = 370

The logic followed to find the armstrong number is:

while( temp != 0 )

{

    remainder = temp%10;

    sum = sum + remainder*remainder*remainder;

    temp = temp/10;

}

Please see the video for more details

Was it useful?  




Please login to reply to this problem.



Related Problems on Fixoncloud