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
50 POINTS PLEASE HELP MEEEEEEEEE!!!!!!
Zolol [24]

The answer is A for 1. And C for 2.

Hope this helps.

3 0
4 years ago
Read 2 more answers
Element will you include to present numerical data on the slide
Sveta_85 [38]
I believe a graph, because it shows data.
8 0
4 years ago
Mention three types of pipeline hazards​
kaheart [24]

Answer:

Structural Hazards.

Data Hazards.  

Control Hazards.

Explanation:

7 0
3 years ago
Read 2 more answers
Help me with this question asap please :)
Svetradugi [14.3K]

Answer:

I think it's sequence as there is a pattern of connection in the words

8 0
2 years ago
Someone knows a good compiler for iPad? It has to be an app
aksik [14]
Jedona is a good one
5 0
3 years ago
Other questions:
  • Write a program that lets a user enter N and that outputs N! (N factorial, meaning N*(N-1)*(N-2)*..\.\*2*1). Hint: Initialize a
    5·1 answer
  • Consider the unsigned decimal number 35. What is the value in hexadecimal?<br><br> 1. 3510 = ____ 16
    13·1 answer
  • What is the name of the subsystem that transfers data between components inside a pc or between pcs?
    12·1 answer
  • Cómo pongo un tomo de llamada SIN PAGAR?
    7·1 answer
  • In the Word 2016 window, where is the Status bar located?
    11·1 answer
  • A tax return preparer, routinely publishes a schedule of the fees she charges her clients. For how long must keep copies of the
    7·1 answer
  • Write a program that prompts the user to enter the minutes (e.g., 1 billion), and displays the number of years and days for the
    7·1 answer
  • Given two integer variables distance and speed, write an expression that divides distance by speed using floating point arithmet
    13·1 answer
  • What method of technical drawing uses converging lines?
    7·1 answer
  • Melissa is working on her Cell class by adding new methods. However, in her most recent version, she is receiving errors in some
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!