Current location - Training Enrollment Network - Mathematics courses - How to determine I and S in the compulsory three-program box of senior high school mathematics?
How to determine I and S in the compulsory three-program box of senior high school mathematics?
I is called a loop variable, which is generally assigned to 1, that is, i= 1, but it is related to the content of the loop and may also be assigned to 0 or others.

S is called the summation variable, and if it is summed circularly, it is assigned to 0, and if it is quadrature circularly, it is assigned to 1.

For example, the sum of 1+2+3+ 100, the program is

i= 1

s=0

When I<= 100

s=s+i

Endor

Print s

For example, to find the product of 1 * 2 * 3 * * 100, the program is

i= 1

s= 1

When I<= 100

s=s*i

Endor

Print s