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