+ 3

Armstrong Number could anyone break this down elaborately?

r = n%10; c = r*r*r; sum = sum + c; n= n/10;

28th Oct 2019, 1:43 PM
Dipanjan Basu
Dipanjan Basu - avatar
1 Respuesta
+ 6
You did not initialize your variables... Assuming that r, n, c, and Sum are integers... r was assign to the value of the remainder of the division of n to 10. c was assigned to the value of r to the power of 3 sum is assign the the initial sum value plus the value of c Lastly, n is assign to the value of initial value of n that is divided by 10
29th Oct 2019, 6:12 AM
MCGAmedCoder gamerArtist
MCGAmedCoder gamerArtist - avatar