How to use the do while statement in C language: The basic structure of do while is [do{ }while();]. If the content in the while statement is true, the while loop will be executed. If it is not true, the while loop will end. .
[Related learning recommendations: C language tutorial video]
Use Method of do while statement in c language:
1. First, we define a few variables
int i,a;
i=0;a= 5;
2. The basic structure of do while is
do { }while();
where the loop statement is written inside the braces
3. If the content in the while statement is true, execute the while loop. If it is not true, end the while loop. For example, write a>i; note the semicolon after while()
4. For example, we write i in the loop statement and perform the increment operation of i
5. At this time, we write the output statement. Look at the changes in the value of i
6. Execute our statement, we will find that the output value of i is 5; the loop ends when the loop in while does not hold.
If you want to learn more about programming, please pay attention to the php training column!
The above is the detailed content of How to use do while statement in c language. For more information, please follow other related articles on the PHP Chinese website!