fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int num=1531,og_num,remainder,result,n=3;
  6. og_num=num;
  7.  
  8. // while(og_num!=0){
  9. // num/=10;
  10. // n++;
  11. // }
  12. while(num!=0){
  13. remainder%10;
  14. result+=pow(remainder,n);
  15. num/=10;
  16. }
  17. if(result==num){
  18. printf("Armstrong");
  19. }
  20. else{
  21. printf("not an armstrong");
  22. }
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
Armstrong