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