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
Before a program written in c can be executed on a computer, what step is required to be done first?
sergejj [24]
It should be compiled. It won't work if it's not compiled.
6 0
3 years ago
What do you understand by cloud computing? list the advantages of clould computing.​
LenaWriter [7]

Answer:

Cloud infrastructures support environmental proactivity, powering virtual services rather than physical products and hardware, and cutting down on paper waste, improving energy efficiency, and (given that it allows employees access from anywhere with an internet connection) reducing commuter-related emissions.

Explanation:

3 0
2 years ago
Read 2 more answers
Which of the following declares an abstract method in an abstract C++ class? (Points : 2) public: void print();
Dahasolnce [82]

Answer:

public: virtual void print()=0;

Explanation:

An abstract class contains a pure virtual function. Pure virtual class cannot be instantiated but it can be subclassed and the subclass can provide an implementation of the function.

A virtual function declaration in the class is preceded by the virtual keyword. For example, virtual void print();

A pure virtual function declaration is followed by '=0;'

public: virtual void print()=0;

4 0
3 years ago
In the SQL environment, a _____________ is a logical group of database objects – such as tables and indexes – that are related t
Paha777 [63]

Answer:Schema

Explanation: A schema is the group that contains objects of databases with views, index, triggers, tables etc features. The specific user can access schema who persist a certain username.The user is considered as the owner of the database and its element.

Schema is usually bound to have only single database.There are some schema that are already present in the system as the in-built schema .E.g.- sys, guest etc.

5 0
3 years ago
When you print ____, the presentation is printed with one or more slides on each piece of paper?
Artist 52 [7]
When you print handouts, the presentation is printed with one or more slides on each piece of paper. When you print handouts, it's best to have the presentation printed on them for those who can not view the presentation clearly to follow along with. This also serves as a great tool for people who missed the presentation to receive a handout later or for those there to take home and review. 
8 0
2 years ago
Other questions:
  • What car dealership websites did you use to conduct your research?​
    8·1 answer
  • To build a user interface that contains graphical components, the components ____. must each be added to a separate panel. must
    7·1 answer
  • The video game machines at your local arcade output coupons depending upon how well you play the game. You can redeem 10 coupons
    14·1 answer
  • Anybody know this question???
    6·1 answer
  • With _________, users will receive recommendations for items liked by similar users.
    9·1 answer
  • A ___________ is a variable used to pass information to a method.
    11·2 answers
  • . Write at least three benefits of using a network.​
    8·1 answer
  • The math function ceil(x) returns the smallest integer that is greater than or equal to x. True False
    12·1 answer
  • Glenda is searching airline schedules on HolApp, a mobile Web application. While browsing the application, a banner appears on t
    12·1 answer
  • 84 104 101 32 97 110 115 119 101 114 32 105 115 32 53 48 33 There's a way to make this meaningful; find it!
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!