fork download
  1. #include <stdio.h>
  2. //a{n} = -6a{n-1} -9a{n-2}, a{1}=1, a{2}=2(再帰あり版)
  3. int main(void){
  4. int i,n=4,a,b=3,c=2;
  5. for (i=3; i<=4; i++){
  6. a=2*b+c;
  7. c=b;
  8. b=a;
  9. }
  10. printf("%d no %d",n,a);
  11. }
  12.  
Success #stdin #stdout 0s 5280KB
stdin
5
stdout
4 no 19