Consider the following iterative implementation to find the nth fibonacci number? [code] int main() { int n = 10,i; if(n == 1)

Consider the following iterative implementation to find the nth fibonacci number?
Code:
int main()
{
    int  n = 10,i;
    if(n == 1)
        printf("0");
    else if(n == 2)
        printf("1");
    else
    {
        int a = 0, b = 1, c;
        for(i = 3; i <= n; i++)
        {
            c = a + b;
            ________;
			________;
        }
        printf("%d",c);
    }
   return 0;
}
Which of the following lines should be added to complete the above code?
A.
c = b
b = a
B.
a = b
b = c
C.
b = c
a = b
D.
a = b
b = a
 

Tìm kiếm

Back
Top