fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int a,b,c,d;
  5. a=3;
  6. b=0;
  7. c=0;
  8. d=0;
  9. while(b<=10000){
  10. c=2*a-b;
  11. a=b;
  12. b=c;
  13. d=d+1;
  14. }
  15. printf("10000を超える最初の値:%d\n",b);
  16. printf("10000を超える時の数列の最初の番号:%d\n",d);
  17. return 0;
  18. }
Success #stdin #stdout 0s 5300KB
stdin
Standard input is empty
stdout
10000を超える最初の値:16386
10000を超える時の数列の最初の番号:13