I don't understand the sigma notation and for loop

后端 未结 7 567
忘掉有多难
忘掉有多难 2021-01-05 04:10

I have the book saying that

\"enter

and says that this is equivalent to saying

7条回答
  •  Happy的楠姐
    2021-01-05 04:33

    If you don't understand C code, it is because of mistakes in it.

    It must be 1 instead of i in first case:

    for(i = 1; i <= N; i++)
        Sum += 1;
    

    It must be i instead of 1 and 1 instead of k there in the second case:

    for(k = j; k <= i; k++)
        Sum += 1;
    

    P.S. Also you have mistypo in the formula itself. 1 is skipped after Sigma by some reason. and j and i are swaped...

    What is this book you are talking about?

提交回复
热议问题