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
The buttons on a specific tab are organized into logical Ribbons. <br> T<br> F
NeTakaya
I believe the answer would be true
8 0
2 years ago
Read 2 more answers
The beginning statement of a loop is called a declaration.<br> True<br> False
Ilya [14]
It is true the reason why it is true is
4 0
2 years ago
Read 2 more answers
Fill in the missing step in the following deadlock situation. Two users from the local board of education are each running a pro
Softa [21]

Answer:

b. P2 requests drive 2 and gets it.

Explanation:

Two users from the local board of education are each running a program (P1 and P2), and both programs will eventually need two DVD drives to copy files from one disc to another. Only two DVD-R drives are available and they’re allocated on an "as requested" basis. Soon the following sequence transpires: P2 requests drive 2 and gets it.

7 0
3 years ago
If a device does not require a driver, it is _____.
xxTIMURxx [149]

Answer:

(B) plug and play

Explanation:

If a device does not require a driver, it is <u>plug and play</u>. Plug and Play (PnP) is a combination of hardware and software support that enables a computer system to recognize and adapt to hardware configuration changes with little or no intervention by a user, including the loading of appropriate drivers.

7 0
3 years ago
HELP ME ASAP
ruslelena [56]

it is title page and give me a ❤

3 0
3 years ago
Other questions:
  • Most languages allow a specialized selection structure called the ____ structure when there are several distinct possible values
    8·1 answer
  • Controlled intersections use some form of which of the following:
    7·1 answer
  • Which one of the following parts of a universal motor does not move? A. The armature B. The field coil C. The shaft D. The commu
    5·1 answer
  • A characteristic of a 3D model that a 2D model does not have is:
    8·1 answer
  • I need urgent help. which of these network has minimum data loss. a. LAN b. MAN c. WAN ​
    11·1 answer
  • 2) What are two reasons we analyze algorithms?
    7·2 answers
  • Write a program that reads in 10 numbers and displays the number of distinct numbers and the distinct numbers in their input ord
    14·1 answer
  • Xxx<br>uuuuuu<br>uuuu<br>jjnmn<br>jjh
    12·1 answer
  • Charles was supposed to present his PowerPoint slides to his classmates in a classroom, but now he has to present in the auditor
    12·2 answers
  • You have been elected to assist the school's yearbook committee and newspaper club in purchasing new computers. The current comp
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!