fork download
  1. #include <stdio.h>
  2. //練習問題F
  3.  
  4. int func(int);
  5.  
  6. int main(void) {
  7. int n = 3;
  8. printf("数列anについて, n=%dのときの値は%d\n", n, func(n));
  9. return 0;
  10. }
  11.  
  12.  
  13. int func(int n){
  14.  
  15. if (n==0)
  16. {return -1;}
  17. else
  18. {return 3*func(n-1)+5;}
  19.  
  20. }
  21.  
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
数列anについて, n=3のときの値は38