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
In three to five sentences, explain the function of the computer's operating system.
Sati [7]

Answer:

An Operating System (OS) is an interface between a computer user and computer hardware. An operating system is a software which performs all the basic tasks like file management, memory management, process management, handling input and output, and controlling peripheral devices such as disk drives and printers.

Explanation:

3 0
2 years ago
What type of measurement are each of the following
bixtya [17]

Answer:

unities

Explanation:

Every one may be counted in unities

3 0
2 years ago
When you learned about the Highway Transportation system you learned about 6 different types of people as roadway users. Choose
Nimfa-mama [501]

<em><u>Answer:</u></em>

<em><u>1. Pedestrians - Most of pedestrians use to walk on the footpath along side road that keeps them on a safe side. But there are places without footpath along side road, in that case they have to walk on the road itself. Here, we need to take care for them. We need to wait in case they are crossing road and also check for them while taking a turn. </u></em>

<em><u> </u></em>

<em><u>2. Cyclists - They travel on road but are tough to figure out. They travel at a slower pace compared to cars. To avoid any accident with them, we are supposed to give them enough space which should be equivalent to a car's space. </u></em>

<em><u> </u></em>

<em><u>3. Motorcyclists - They can pass by very closely and also come between lanes. Most of the things to be considered here are same as that of cyclists. Here also, we need to check for them carefully while taking a turn. Also, need to give them enough space.</u></em>

<em><u>Explanation:</u></em>

5 0
2 years ago
Read 2 more answers
To ensure proper seating of the valve, the valve seat must be
Marta_Voda [28]
The vaule must be set true not false
5 0
2 years ago
Mellissa wants to pursue a career in database administration. Select the requirements needed to achieve this.
adelina 88 [10]
I think its the answer is 4 
8 0
3 years ago
Read 2 more answers
Other questions:
  • An important piece of a project is past due date.
    9·2 answers
  • Explain the need for data structures when developing software.
    12·1 answer
  • In Vista and Windows 7, the Appearance and Personalization option allows you to change the
    14·1 answer
  • Each professional association has
    7·1 answer
  • When was kale discovered?
    9·1 answer
  • Nielsen purchases scanner data from retail transactions to track the sales of consumer packaged goods, gathered at the point of
    14·1 answer
  • The technology dealing with robots is called
    6·1 answer
  • Explain why interrupt times and dispatch delays must be limited to a hard real-time system?
    8·1 answer
  • How to set Campaign goals?
    11·1 answer
  • You are creating a query for a website. The query
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!