fork download
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int num,orinum,rem,result=0;
  5. printf("enter a number\t");
  6. scanf("%d",& num);
  7. //orinum=num;
  8. for(orinum=num;orinum>0;orinum=orinum/10)
  9. {
  10. rem=orinum%10;
  11. result=result+(rem*rem*rem);
  12. }
  13. if(result==num)
  14. printf("%d is an armstrong number",num);
  15. else
  16. printf("%d is not an armstrong number",num);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5520KB
stdin
4
stdout
enter a number	4 is not an armstrong number