How to use the do while statement in C language
This article introduces the knowledge of "how to use do while sentences in c language". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The general form of a do-while loop statement is as follows:
Do
Statement
While (expression)
When using do-while statements, you need to be aware of the following issues:
(1) when the body of the loop needs to be composed of multiple statements, use compound statements.
(2) because the execution process of the do-while statement is to execute the loop body first, and then judge the loop condition, the loop body will be executed at least once.
Example: programming for 1 + 2 + 3 +. Value of + 100, using the do-while statement.
1#include
2 int main ()
3 {
4 int iTunes 1, sum=0
5 do
6 {
7 sum=sum+i
8 iTunes +
9} while (I