0
In for loop for factorial, if the initial value of i is 1 then how can we decrement its value by ++i in dry run?
factorial=factorial*i; for (i=1;i <=n;++i){ cout <<factorial <<endl;}
2 Réponses
+ 7
Is this an "arrange in correct order" type question? If so, this is the answer.
for (i = 1; i <= n; ++i) {
factorial = factorial * i;
cout << factorial << endl; }
The above code prints values from 1! to n!. And, ++i is not decrement. It's increment.
+ 6
What? Could you explain please? I don't understand what you want...