fork download
  1. // sum of first and last digit
  2. // writen by : sammo
  3. #include <stdio.h>
  4. int main()
  5. {
  6. int a;
  7. scanf("%d",&a);
  8. int n = a%10;
  9. while(a != 0){
  10. a/=10;
  11. if(a < 10){
  12. break;
  13. }
  14. }
  15. printf("%d",a+n);
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 5276KB
stdin
34654
stdout
7