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