fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4. int main()
  5. {
  6.  
  7. unsigned int copy_word, word,digit=0, n=11, new_first=0, new_last=0,sum=0,k;
  8. printf("Enter word = ");
  9. scanf("%d", &word);
  10. copy_word=word;
  11. n=word/10;
  12. digit+=1;
  13. while(n>=10){
  14. n/=10;
  15. digit+=1;
  16. }
  17. k=1;
  18. while(digit-k!=0){
  19. copy_word=word/(pow(10,digit-k));
  20. new_first=copy_word%10;
  21. k+=1;
  22. sum+=new_first*pow(10,digit-k);
  23. }
  24. printf("\n%d",sum);
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 10320KB
stdin
10
stdout
Enter word = 
0