1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Shalnov [3]
3 years ago
13

Write any three type of looping structure with syntax​

Computers and Technology
1 answer:
schepotkina [342]3 years ago
7 0

Answer:

The correct answer to this question is given below in the explanation section.

Explanation:

There are three types of loops that are used almost in all programming languages today. Loop is used when you want to execute many times the same lines of codes.  These loops are given below:

For-loop

While-loop

Do-while loop

The syntax of these loops is given below. However, it is noted that these syntax are based on C++ language.  :

1-For-loop:

<em>for ( init; condition; increment/decrement ) { </em>

<em>   statement(s); </em>

<em>}</em>

init: this is executed first and only once, this allows to initialize and declare the loop control variable.

Condition: next condition is evaluated, if the condition is true then the loop body will get executed. And, if it gets false, the loop will get terminated.

increment: this will increment/decrement the counter (init) in the loop.

for example: to count number 1 to 10, the for-loop is given below:

<em>int total=0;</em>

<em>for (int i=0; i>10;i++)</em>

<em>{</em>

<em>total=total + i;</em>

<em>to</em>

<em>}</em>

2-While loop:

Repeats a statement or group of statements in the body of a while-loop while a given condition is true. It tests the given condition before executing the loop body.

syntax:

<em>while(condition) { </em>

<em>   statement(s); </em>

<em>}</em>

For example: To count number 0 to 10.

<em>int a = 0;  </em>

<em>int total =0;</em>

<em>   // while loop execution </em>

<em>   while( a < 11 ) { </em>

<em>      total = total + a</em>

<em>      a++; </em>

<em>   }</em>

<em />

3- do-while loop:

Do-while works like a while statement, while it tests the condition at the end of the loop body.

Syntax:

<em>do { </em>

<em>   statement(s); </em>

<em>}  </em>

<em>while( condition );</em>

<em />

For example:

<em>int a = 0;  </em>

<em>int total =0;</em>

<em>   // while loop execution </em>

<em>   do { </em>

<em>      total = total + a</em>

<em>      a++; </em>

<em>   }while( a < 11 )</em>

<em />

You might be interested in
Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?
NeTakaya

Answer: Most obvious spam messages will still reach the client computer

Explanation:

It should be noted that by default, usually the junk email filter is already set to No Automatic Filtering.

When a user configures No Automatic Filtering in Junk Mail Options, it should be noted that most obvious spam messages will still reach the client computer.

Therefore, the correct option is D.

5 0
3 years ago
HELPPPPPPPP
Reika [66]
The answer is visual hierarchy :)
4 0
3 years ago
Read 2 more answers
Which of the following is a step in paraphrasing?
Inga [223]

to review the most important supporting points from the original information

7 0
3 years ago
Read 2 more answers
Why is web arnea of so much commetition today
Sonja [21]

Answer:

try checking your internet or reset your computer if that still dosnt work try putting all your stuff on an USB stick and then after you did that factory data reset your computer and that should work but before you reset your computer take it into a computer specialist

Explanation:

8 0
3 years ago
Horizontal scaling of client/server architecture means _____.
aalyn [17]
<span>Horizontal scaling of client/server architecture means that more machines or more client workstation are added in the network. The impact on the network should be small and negligible. 
Vertical scaling on the other hand means that more power (processing units) are added in the network. </span>
4 0
3 years ago
Other questions:
  • Which of the following criteria would not make a person eligible to receive medicare benefits?Which of the following criteria wo
    12·2 answers
  • What is the correct order of network types when categorized by their size or the physical area they cover, from largest to small
    10·1 answer
  • Gina's teacher has sent her a Word document that contains the names of all the students who are participating in the
    11·2 answers
  • Rob Janoff believes that technology should not be used too
    11·1 answer
  • The expression that is tested by a switch statement must have a(n) __________ value.
    12·1 answer
  • What do you need to do before you can sort and filter data in a data base?
    12·1 answer
  • How do you change the name on your brainly account?
    12·1 answer
  • Assume variables SimpleWriter out and int n are already declared in each case. Write a while loop that printsA. All squares less
    11·1 answer
  • Giải thích mục đích của các thao tác open() và close().
    6·2 answers
  • 1. Which sentence best expresses the main idea
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!