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
Basile [38]
3 years ago
11

How I to turn this ''loop while'' in ''loop for''? var i = 0; while (i < 20) { var lineY = 20 + (i * 20); line(0, lineY, 400,

lineY); i++; }
Computers and Technology
1 answer:
Fudgin [204]3 years ago
5 0

Answer:

for(i = 0; i<20;i++){

lineY = 20 + (i * 20);

line(0, lineY, 400, lineY) }

Explanation:

First declare and initialize the variable i. You have not specified the data type of i so if the data type of i is integer i.e. int then you should declare i variable in the for loop as for(int i = 0; i<20;i++)

So the given while loop has a variable i which is initialized to 0. Then while(i<20) means that while loop executes until the value of i exceeds 20. If this while condition is true then the two statements inside its body will execute. The two statements are: lineY = 20 + (i * 20);

line(0, lineY, 400, lineY);

The value of i ins incremented after each iteration i.e. i++

So while loop has the following syntax"

1) initialization;  ---->  i = 0

2) while(condition) {  ----> i<20

3) loop body ----->  lineY = 20 + (i * 20); line(0, lineY, 400, lineY);

4) increment or decrement loop variable  } ----> i++

For loop has the following syntax:

for( initialization of loop variable ; condition; decrement/increment loop variable)  {

loop body }

Here:

initialization  ---->  i = 0

condition        ----> i<20

loop body     -----> lineY = 20 + (i * 20); line(0, lineY, 400, lineY);

increment or decrement loop variable  ---->  i++

You might be interested in
ZipCar uses cutting edge wireless technology combined with sophisticated data management and security techniques to assure that
Bingel [31]

Answer:

dependable

Explanation:

3 0
2 years ago
which endpoint application runs on an endpoint device that only detects an attack in an endpoint device? chqgg
WARRIOR [948]

A host-based intrusion detection system works similarly to a network-based intrusion detection system in that it can monitor and analyze both the internal workings of a computer system and the network packets on its network ports.

<h3>What is Host-Based IPS?</h3>
  • A host-based intrusion detection system works similarly to a network-based intrusion detection system in that it can monitor and analyze both the internal workings of a computer system and the network packets on its network ports.
  • The Host-based Intrusion Prevention System (HIPS) guards against malicious software and other activities that aim to harm your computer. HIPS uses sophisticated behavioral analysis in conjunction with network filtering's detection capabilities to keep track of active programs, files, and registry keys.
  • The integrated endpoint security system known as endpoint detection and response (EDR), also referred to as endpoint threat detection and response (ETDR), combines real-time continuous monitoring and gathering of endpoint data with rules-based automated reaction and analysis capabilities.

To learn more about Host-Based IPS refer to:

brainly.com/question/20490376

#SPJ4

5 0
1 year ago
Chris is working with other employees on a worksheet. the other employees have made comments, but they are not visible.
andriy [413]

Answer:

a. select show all comments on the review tab

Explanation:

Please mark me brainliest if correct

7 0
2 years ago
When do you use a for loop instead of a while loop? (There may be more than one answer.)
statuscvo [17]

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

8 0
2 years ago
In Linux, when logged in as a normal user with root privileges, which command must precede the apt-get command in the command li
siniylev [52]

Answer:

"sudo" is the command to get super user or root privileges in linux.

Explanation:

in order to install package with root privilege in linux, the command would be

sudo apt-get install <package name>

8 0
3 years ago
Other questions:
  • 2- There are many different design parameters that are important to a cache’s overall performance. Below are listed parameters f
    11·1 answer
  • 5. The hazardous component in most antifreeze is _____, which is extremely toxic to humans and animals. A) Calcium Carbonate B)
    13·2 answers
  • What is the name of the most expensive car and how much is it and what are its features
    15·1 answer
  • Write a program that asks the user to input
    11·1 answer
  • why is there a need of properly interpreting teacher's/manufacturer's specifications before operating any food processing equipm
    9·1 answer
  • 19. The power supply in your server has just been replaced because of power problems. Your server boots, but now there is a mess
    13·1 answer
  • , 13 dB correspond to a power ratio of ....?
    14·1 answer
  • Meet.go ogle.etj-dovn-kds​
    14·1 answer
  • Fill in the blank with the correct term.
    10·2 answers
  • What is a complier in computers
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!