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. c=x/100;
  7. b=(x-c*100)/10;
  8. a=x%10;
  9. sum=a+b+c;
  10. scanf("%d",&x);
  11. printf("sum=%d\n",sum);
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0.01s 5320KB
stdin
123
stdout
sum=228