fork download
  1. #include <stdio.h>
  2. int main(void) {
  3. int n = 4;
  4. int b = 3, c = 2;
  5. int tmp;
  6. for (int i = 3; i <= n; i++) {
  7. tmp = 2 * b + c;
  8. c = b;
  9. b = tmp;
  10. }
  11. printf("数列a%dの値は%d\n", n, b);
  12. return 0;
  13. }
Success #stdin #stdout 0.01s 5328KB
stdin
Standard input is empty
stdout
数列a4の値は19