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
spin [16.1K]
2 years ago
9

When do you use a for loop instead of a while loop? (There may be more than one answer.)

Computers and Technology
1 answer:
statuscvo [17]2 years ago
8 0

Answer:

- You know how many times you want the loop to run.

- When there is a defined start and end.

Explanation:

Required:

When to use for instead of while loop?

First, it should be noted that both for loop and while loop are used for iteration. However, depending on the scenario; there is preference on one to the other.

The basic syntax of for loop is:

for(start;end;condition)\{\}

<em>The condition could either be increment or decrement</em>

The basic syntax of while loop is:

while(condition)\{\}

<em>The condition could be any condition whatsoever</em>

Analyzing the options one after the other.

1. How many times the loop to run.

The for loop is preferred here because of the simplicity of the for loop.

2. & 3. Both the for and while loops are used for code repetition and to perform number calculations

4. Defined start and end.

From the syntax of the for loop

for(start;end;condition)\{\}

<em />

A for loop has a definite start and end in its basic syntax and is more preferable to use instead of a while loop.

<em />

<em />

Hence, 1 & 4 answer the question

You might be interested in
Look at the following code.int x = 7;int *iptr = &amp;x;What will be displayed if you send the expression *iptr to cout ? What h
masha68 [24]

Answer:

The answer to the given question can be given as:

The value of *iptr is 7. and the value of iptr is dynamic.

Explanation:

In the c++ code, it is defined that x is an integer variable that assigns a value which is 7. Then we define a pointer variable that is *iptr. This variable holds an address of the x variable. When we print the value of the iptr variable. if we use the expression *iptr to print value of the pointer variable by cout that is used in c++ for pint values. so the value of the iptr is 7. If we use the expression iptr sent to cout so we show the address of the variable x. In the pointer, it manages the addresses of dynamically allocated so the address of the variable is changed on execution time.

4 0
3 years ago
Can anyone help me with these assignments??? Hands On Assignments- Insertion of Symbols, Special Characters, and Images.... and
Alekssandra [29.7K]

Answer:

yes send me the worksheet

Explanation:

5 0
2 years ago
Please please help I don’t understand this
garik1379 [7]

Answer:

It is this because yass

Explanation:

And yes

6 0
2 years ago
Read 2 more answers
[True/False] Mainframes, unlike microcomputers, allow users unlimited and flexible access to computing power.
Lemur [1.5K]

Answer:

The given statement is "False".

Explanation:

Mainframes computer are also known big iron computer basically Mainframe computer is used by the big organization when the organization needs to work in the high-level project. The mainframe has big data processing. It is highly used in critical applications such as ERP(Enterprise resource planning).

A mainframe computer is not a flexible computer also they are not potable .microcomputers, are more flexible computers we can easily work on the microcomputers.

So the given statement is False.

8 0
2 years ago
Why do I have two random warnings?
Misha Larkins [42]
Just a guess, maybe you’ve been reported for having an incorrect answer two times? I’m really not sure I’m just trying to give out possibilities. Maybe if your a Brainly Helper you haven’t been active so they are giving you warnings? Does clicking on the warning tell you the reason for them? Maybe the system thinks your a robot? I’m not sure just trying to give possible reasons, but you could try contacting customer support, but they aren’t always the quickest at responding.

Have a good day!
8 0
3 years ago
Other questions:
  • If it can be applied, the least-damaging recovery option is ________.
    10·1 answer
  • Lesson 1 (4.0 points)
    13·2 answers
  • Consider the concept of cultural lag. Identify two American values that are “lagging.” What are three norms that are lagging? Ho
    11·1 answer
  • Which of the following was not important in the development of the internet?
    10·2 answers
  • A type of wireless local area network technology​
    7·2 answers
  • This diagram shows a number of computing devices connected to the Internet with each line representing a direct connection.
    11·1 answer
  • What is distribution hardware?
    14·1 answer
  • When an expression containing a ____ is part of an if statement, the assignment is illegal.
    14·2 answers
  • Write the Stats method record that takes a test score and records that score in the database. If the score already exists in the
    15·1 answer
  • A palindrome is a string that reads the same from left to right and from right to left. Design an algorithm to find the minimum
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!