Is armstrong number

on every input it is showing true? please help me to find correct code

do all changes on different number otherwise you loose the original no

Modified Code

sorry but what does it mean?

let the n is 1634
now you find no of digit it int using this loop

while(n>0)
    {
        n = n/10;
        digits = digits + 1;
    }

now after this loop your n is 0
you loose the original no 1634

hence first store it in another variable called num so that your original no will not lost

look at the above Modified Code

1 Like