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