fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a=1,count=0;
  5.  
  6. while(a<=100000){
  7. a=2*a+1;
  8.  
  9. if((a>=100)&&(a<=10000)){
  10. count++;}
  11. }
  12. printf("100以上から10000以下となるのは%d個ある",count);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
100以上から10000以下となるのは7個ある