fork download
  1. #include <stdio.h>
  2. int main(){
  3. int an , n;
  4. an = 3;
  5. n = 0;
  6.  
  7. while( an < 10000 )
  8. {
  9. an = 2 * an - 1;
  10. n = n + 1;
  11. }
  12.  
  13. printf("数列が初めて10000を超えるときの値は、%dで%d番目である。\n",an,n);
  14.  
  15. return 0;
  16. }
  17.  
  18.  
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
数列が初めて10000を超えるときの値は、16385で13番目である。