home work questions.??

Fibonacci series: Any number in the series is obtained by adding the previous two numbers of the series.

Let f(n) be nâ€™th term.

f(0)=0;

f(1)=1;

f(n)=f(n-1)+f(n-2); (for n>=2)

Series is as follows

0

1

1 (1+0)

2 (1+1)

3 (1+2)

5 (2+3)

8 (3+5)

13 (5+8) and so onâ€¦

*////PROGRAM:////****

#include

int main() {

//array fib stores numbers of fibonacci series

int i, fib[25];

/////////initialized first element to 0

fib[0] = 0;

/////////initialized second element to 1

fib[1] = 1;

/////////loop to generate ten elements

for (i = 2; i < 10; i++) {

///////// iâ€™th element of series is equal to the sum of i-1â€™th element and i-2â€™th element.

fib[i] = fib[i - 1] + fib[i - 2];

}

printf("The fibonacci series is as follows

â€ś);

/////////print all numbers in the series

for (i = 0; i < 10; i++) {

printf(â€ť%d

", fib[i]);

}

return 0;

}

OUTPUT:

The fibonacci series is as follows

0

1

1

2

3

5

8

13

21

34

yaâ€¦ please helpâ€¦

thanks a lotâ€¦!!!

#include

void main()

{

int fib,num,n1,n2;

printf(â€śenter num valueâ€ť);

scanf("%d",&num);

printf(â€śenter n1,n2 valuesâ€ť);

scanf("%d,%d",&n1,&n2);

for(i=0;i