include stdio define MAX_N 30 int main int fib MAX_N fib fib fib for M

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include<stdio.h>
#define MAX_N 30
int main()
{
int fib[MAX_N], i;
fib[0] = 0; fib[1] = 1; fib[2] = 1;
for(i=3;i<MAX_N;i++)
{
fib[i] = fib[i-1] + fib[i-2];
}
printf("#include<stdio.h>\nint fib[%d] = { 0", MAX_N);
for(i=1;i<30;i++) printf(", %d", fib[i]);
printf("};\n\nint main()\n{\n\tint n;\n\tscanf(\"%%d\", &n);\n\tprintf(\"%%d\", fib[n]);\n\treturn 0;\n}\n");
return 0;
}