- Enter a number to assign to the n variable:
printf("Enter a number ");scanf("%d",&n);
- Invoke the findarmstrong function. The value assigned to n will get passed to this function:
findarmstrong(n)
- In the function, the passed argument, n, is assigned to the numb parameter. Execute a while loop to separate out all the digits in the numb parameter:
while(numb >0)
- In the while loop, apply the mod 10 (%10) operator on the number assigned to the numb variable. The mod operator divides a number and returns the remainder:
remainder=numb%10;
- Push the remainder to the stack:
push(remainder);
- Remove the last digit of the number in the numb variable by dividing the numb variable by 10:
numb=numb/10;
- Repeat steps 4 to 6 until ...