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