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;
}
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
Join The Discussion