fork download
  1. #include <stdio.h>
  2. //a{n+1} = -2a{n} + 4, a{0}=2(再帰なし版)
  3. int main(void) {
  4. int n = 4;
  5. int an= 2;
  6. for(int i=0;i>n;i++){
  7. an=-2*(n-1)+4;
  8. }
  9.  
  10. printf("数列a%dの値は%d\n", n, an);
  11.  
  12. return 0;
  13. }
  14.  
  15.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
数列a4の値は2