fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int i,x[100];
  5. x[1]=1;
  6. for(i=2;i<100;i++){
  7. x[i]=2*x[i-1]+1;
  8. if(x[i]>1000){
  9. printf("1000を超えるのは%dです。",i);
  10. break;
  11.  
  12. }
  13.  
  14. }
  15.  
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
1000を超えるのは10です。