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