fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a,b,c,i=0;
  5. for (a=1,b=2;b <= 1000;){
  6. c =3*b+ 2*a;
  7. a = b;
  8. b = c;
  9. if ((100 <= b) && (b <= 1000)){
  10. i = i +1;
  11. }
  12. }
  13. printf("この数列のうち、100以上から1000以下となるのは%d個ある",i);
  14. return 0;
  15. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
この数列のうち、100以上から1000以下となるのは2個ある