fork(2) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int x,b0,b1,b2,b3,sum;
  6. scanf("%d",&x);
  7. b0=x%10;
  8. b3=x/1000;
  9. b2=(x-b2*1000)/100;
  10. b1=(x-b3*1000-b2*100)/10;
  11. printf("b0=%d\nb2=%d\nb1=%d\nb3=%d\n",b0,b2,b1,b3);
  12. sum=b0+b1+b2+b3;
  13. printf("sum=%d",sum);
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0.01s 5320KB
stdin
1458
stdout
b0=8
b2=14
b1=-94
b3=1
sum=-71