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