fork download
  1. #include <stdio.h>
  2. int main() {
  3. int a,b,c,d,e,f;
  4. scanf("%d",&a);
  5. b=a/10000;
  6. c=(a%10000)/1000;
  7. d=(a%1000)/100;
  8. e=(a%100)/10;
  9. f=(a%10);
  10. printf("%d",b+c+d+e+f);
  11. return 0;
  12.  
  13. }
Success #stdin #stdout 0s 5268KB
stdin
12345
stdout
15