Examveda

Consider the following iterative implementation to find the factorial of a number. Which of the lines should be inserted to complete the below code?
int main()
{
    int n = 6, i;
    int fact = 1;
    for(i=1;i<=n;i++)
      _________;
    printf("%d",fact);
    return 0;
}

A. fact = fact + i

B. fact = fact * i

C. i = i * fact

D. i = i + fact

Answer: Option B


This Question Belongs to Data Structure >> Miscellaneous On Data Structures

Join The Discussion

Related Questions on Miscellaneous on Data Structures