fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int x,a,b,c,sum;
  6. scanf("%d\n",&x);
  7. c=x/100;
  8. b=(x-c*100)/10;
  9. a=x%10;
  10. sum=a+b+c;
  11. printf("sum=%d\n",sum);
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 5312KB
stdin
123
stdout
sum=6