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