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