fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int n,r,sum=0,temp;
  5. printf("enter the number=");
  6. scanf("%d",&n);
  7. temp=n;
  8. while(n>0)
  9. {
  10. r=n%10;
  11. sum=sum+(r*r*r);
  12. n=n/10;
  13. }
  14. if(temp==sum)
  15. printf("armstrong number ");
  16. else
  17. printf("not armstrong number");
  18. return 0;
  19. }
Success #stdin #stdout 0s 5284KB
stdin
8
stdout
enter the number=not armstrong number