Home > Back-end >  C a nested loop, topic: the sum of the factorial of 1 to 10
C a nested loop, topic: the sum of the factorial of 1 to 10

Time:10-13

Does the second for loop to play braces until t *=j oh, otherwise not ah

CodePudding user response:

Don't need to,
The second cycle in the calculation of factorial, I just only one statement t *=j; There is no need to use parentheses

CodePudding user response:

For loop only execute the next statement without a curly braces, so don't need braces,
Actually can be simplified, a cycle can
Int s=0, t=1;
for(int i=1; i<=10; I++) {
T *=I;
S +=t;
}
Printf (" % d ", s);
  • Related