fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int a=3,n=0;
  6. do
  7. {
  8. a=2*a-1;
  9. n=n+1;
  10. }
  11. while(a<=10000);
  12. printf("この数列が初めて10000を超えるのは%d番目\n",n);
  13. printf("値は%d\n",a);
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 5300KB
stdin
Standard input is empty
stdout
この数列が初めて10000を超えるのは13番目
値は16385