fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7. int i=0;
  8. unsigned int temp=0;
  9. unsigned int result=0;
  10. int array[8]={1,1,1,1,1,1,1,0};
  11. for (i=0;i<8;i++){
  12. temp=array[i]<<(8-i-1);
  13. printf("temp=%d\n",temp);
  14. result+=temp;
  15. }
  16. printf("result=%d\n",result);
  17. return 0;
  18. }
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
temp=128
temp=64
temp=32
temp=16
temp=8
temp=4
temp=2
temp=0
result=254