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