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]
2 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]2 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
Plz show working for binary addition. please solve. 11000 + 110101 + 101011​​
IrinaVladis [17]

Answer:

thats would be 222112 <3

Explanation:

t

5 0
2 years ago
Read 2 more answers
_______________ are distinguished from microcontrollers by their complexity and increased on-chip resources.A. Systems on a chip
weeeeeb [17]

Answer:

the correct option is (A)

Explanation:

According to the given scenario, the system on a chip is a chip that is different from the microcontrollers in terms of complexity and rise on the chip resources

The system on a chip is a circuit i.e. integrated most the computer things

hence, the correct option is (A).

Therefore the rest of the options are wrong

6 0
3 years ago
Read 2 more answers
Adassadad saflalfaklfajfklajfalkfjalkfjalkfalkf
BlackZzzverrR [31]

Answer:

this belongs on r/ihadastroke

Explanation:

5 0
3 years ago
Read 2 more answers
List the six external parts or "peripherals" of a computer system and identify which are output and which are input devices/ Lis
vitfil [10]
Keyboard-Input
Mouse-Input
<u></u>Monitor-Output
Speakers-Output
Printer-Output
Hard Drive<span>-Output</span>
3 0
3 years ago
What type of message authentication code uses hashing to authenticate the sender by using both a hash function and a secret cryp
Vesna [10]
Answer is (HMAC) Hashed Message Authentication Code

This combines authentication via a shared secret cryptography algorithm key with hashing. It involves the client and server each with a private key. The client creates a unique hash per request to the server through hashing the request with private keys.






3 0
3 years ago
Other questions:
  • Brenda wants to finish her presentation with a summary slide . She wants three key messages to appear on each of the photo clips
    6·2 answers
  • Why is the protocol down, even though you issued the no shutdown command for interface vlan 99?
    5·2 answers
  • What types of storage can be used to access your data on another computer?
    7·1 answer
  • Why is it important to explore an Integrated
    13·1 answer
  • Will an email sent from a phone say it was sent from your phone
    5·2 answers
  • How many possible keys does the playfair cipher have? an approximate power of 2
    14·1 answer
  • When discussing the data-modeling building blocks, anything (a person, a place, a thing, or an event) about which data are to be
    15·1 answer
  • Under which of the following conditions will evaluating this boolean expression
    7·1 answer
  • Using the program below, explain what the output will be at LINE A. 1 #include 2#include 3#include 4 5 int value - 128; 6 7 int
    11·1 answer
  • What is aperture priority mode? When might you use this mode on a camera? What is depth of field? How can you adjust the depth o
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!