Suppose n=5, that is, there are five numbers added together to sum up. The program structure is as follows:
1. define the variable n, addends a a and s,
2. Set the initial value of s to 0 and enter n=5.
3. enter a
4.s=s+a
5.n=n- 1
6. If n>= 1, skip to step 3, otherwise continue execution.
7. Output S, and the program ends.
The second problem is a typical branch structure, which judges three possibilities of input data (1, 0, not 1, not 0) and handles them accordingly.
I think it is necessary for liberal arts students to learn some basic computer knowledge. This may be your first contact with this knowledge in your life, or it may be your last chance to learn this knowledge systematically in your life, which is helpful to cultivate your logical thinking ability and future work. Look at it a few times and draw a picture on the paper. It shouldn't be hard to understand.