Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the do while statement in C language

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report