fork download
  1. #include <stdio.h>
  2. //a{n} = -6a{n-1} -9a{n-2}, a{1}=1, a{2}=2(再帰あり版)
  3. int c;
  4. int rec(int n){
  5. c++;
  6.  
  7. }
  8.  
  9. int main(void) {
  10. int n = 4;
  11. printf("数列a%dの値は%d\n", n, rec(n));
  12. printf("このときrecの呼び出し回数は%d",c);
  13. return 0;
  14. }
  15.  
  16.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
数列a4の値は0
このときrecの呼び出し回数は1