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
Default tab stops are set in word every _______ inch. a. ¾ b. ½ c. 1 d. ¼
Dennis_Churaev [7]
A) 3/4 inch Meow! XD
6 0
3 years ago
Any fact or set of facts, such as the words in a letter to a friend or the notes in a song, can become computer ____.
Alina [70]

I think the answer is... data

3 0
3 years ago
/*this function represents
sergey [27]

anything

Explanation:

I know what to say this time

7 0
2 years ago
Read 2 more answers
True or false? LearnSmart (the "smart flash card assignments") really gets your competitive spirit in gear by allowing you to se
vfiekz [6]
<h2>Answer:</h2>

The following statement is TRUE.

LearnSmart (the "smart flash card assignments") really gets your competitive spirit in gear by allowing you to see where you stand as compared to your classmates in terms of your mastery of grammar and vocabulary concepts.

<h2>Explanation:</h2>

LearnSmart is an adaptive technology that is helping a lot of students by letting them judge which parts/topics of the book are not clearly learnt by them and which of them are under their grip.

LearnSmart provides cards with short term questions that make i possible for students to complete their preparation in short time. In addition to this smart flash card assignments are a to compare students preparation relatively.

<h3>I hope it will help you!</h3>
4 0
2 years ago
I’m confused what any of this means can anyone help?
raketka [301]
The answer will be
97
98
96
194
5 0
3 years ago
Other questions:
  • All languages from the second generation on must be translated into machine language for the computer to be able process the inp
    8·1 answer
  • "under the control panel, what console contains print management, computer management, and event viewer?"
    11·1 answer
  • In ssl/tls, a specific set of protocols that a particular cryptographic system will use to provide protection is called a ______
    5·1 answer
  • What is the process of copying items from ram to a storage device?
    8·1 answer
  • Charts are more effective in attaining attentionthen others methods of presenting data. Do you agree?
    10·1 answer
  • Hey guys, I don’t have a problem for you but If anyone knows do you still pass your grade level if you failed 1 class in the las
    11·2 answers
  • Which is a benefit of peer-to-peer networking?
    12·1 answer
  • Why is it important to prepare the farm resources before you start working? explain​
    14·1 answer
  • What are three ways of verifying legitimate right of access to a computer system?
    10·1 answer
  • A user reports that he cant browse to a specific website on the internet. From his computer, you find that a ping test to the We
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!