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
ki77a [65]
3 years ago
13

How many iterations for each for-loop where max = 10 and incr = 3 a. for (int i = 0; i < max; i++) b. for (int i = 0; i <

max; i += 2) c. for (int i = 0; i < max; i += incr) d. for (int i = incr; i < max; i += incr) e. for (int i = max; i > 0; i--) f. for (int i = max; i < 0; i--) g. for (int i = 1; i < max; i *= incr) h. for (int i = 0; i < max; i *= incr)
Computers and Technology
1 answer:
LekaFEV [45]3 years ago
4 0

Explanation:

Answer to the following iterations are:

a)

In the following for-loop, the loop will starts from 0 and end at 9.

for example:

0 1 2 3 4 5 6 7 8 9

So, the loop will iterate 0-9, which means 10 times.

b)

In the following for-loop, the loop will starts from 0 and end at 8 but in the gap of 2 because of the increment of 2 in the variable "i".

for example:

0 2 4 6 8

So, the loop will iterate even times or 5 times, which means 0 2 4 6 8.

c)

In the following for-loop, the loop will starts from 0 and end at 9 but in the gap of 3  because of the increment of 3 in the variable "i" and the value is assign in the variable "incr" is 3.

for example:

0 3 6 9

So, the loop will iterate 4 times, which means 0 3 6 9.

d)

In the following for-loop, the loop will starts from 3 and end at 9 but in the gap of 3  because of the increment of 3 in the variable "i" and the value is assign in the variable "incr" is 3.

for example:

3 6 9

So, the loop will iterate 3 times, which means 3 6 9.

e)

In the following for-loop, the loop will starts from 10 and end at 1 which means reverse order.

for example:

10 9 8 7 6 5 4 3 2 1

So, the loop will iterate 10-1, which means 10 times in reverse order.

f)

In the following for-loop, the loop will not works because of the condition which is i is less than 0 but in the following code loop will starts from 3.

So, that's why loop will not iterate.

g)

In the following for-loop, the loop will starts from 1 and end at 9 but in the multiple of 3  because the variable "i" will multiply by the variable "incr" and the value is assign in the variable "incr" is 3.

for example:

1 3 9

So, the loop will iterate 3 times, which means 1 3 9.

h)

In the following for-loop, the loop is the infinite loop because of the condition which is i is less than max but and the loop will starts from 0 and goes on infinite times.

So, that's why it is the infinite loop.

You might be interested in
You have a computer that runs on a windows 10 operating system and supports modern sleep. what will happen if you close the lid
adell [148]

You have a computer that runs on the Windows 10 operating system and supports modern sleep mode what will happen if you close the computer lid is the computer will be put into sleep mode. If Modern Sleep is supported, the settings for closing the lid will be configured to trigger sleep mode.

A computer system is a basic, complete and functional arrangement of hardware and software with everything needed to implement computing performance. That is the basic working definition of a computer system as we know it, but computer systems have gone through many formal changes over the last few decades.

The physical components of a computer can also be interpreted as hardware. This includes the keyboard, mouse, monitor and processor. Hardware consists of input devices and output devices that make up a complete computer system. Examples of input devices are keyboards, optical scanners, mice and joysticks that are used to enter data into a computer.

You can learn more about computer system here brainly.com/question/14583494

#SPJ4

7 0
1 year ago
Computer in country development explain explain explain in presentation.<br>​
yaroslaw [1]

Answer:

A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as programs. These programs enable computers to perform a wide range of tasks. A computer system is a "complete" computer that includes the hardware, operating system (main software), and peripheral equipment needed and used for "full" operation. This term may also refer to a group of computers that are linked and function together, such as a computer network or computer cluster

6 0
3 years ago
In the source-code file containing a class’s member function definitions, each member function definition must be tied to the cl
jenyasd209 [6]

Answer:

Binary Scope Resolution Operator

Explanation:

The :: (scope resolution) operator is used to get hidden names due to variable scopes so that you can still use them. The scope resolution operator can be used as both unary and binary. Fortunately, in this context we're not dealing with hidden contents; thus the Binary applies better than the Unary.

Cheers

5 0
3 years ago
Wats is a internal disk drive​
NikAS [45]

Answer: Internal disk drive is the main storage device located in a computer. It usually contains software applications, the operating system and other files.

Explanation:

3 0
4 years ago
Read 2 more answers
How did Avery and Garth most likely create their
hram777 [196]
Avery used smartart and added shake
6 0
3 years ago
Other questions:
  • a computer that no longer works after having minor repair work done to it may have been damaged by ______.
    6·1 answer
  • How can investors receive compounding returns
    13·1 answer
  • How to insert header and page number in word 2016?
    8·1 answer
  • What is the simplest way to permanently get rid of a unwanted file
    12·1 answer
  • __________is threatening to steal or actually stealing information from a company and then demanding payment to not use or relea
    13·1 answer
  • To communicate with coworkers in the office
    10·1 answer
  • When the code that follows is executed, a message is displayed if the value the user entersvar userEntry = (prompt("Enter cost:"
    11·1 answer
  • Gus has decided to organize his inbox on June 26 by using folders and deleting irrelevant messages. He creates a folder called "
    12·2 answers
  • Notes on secondary memory​
    7·1 answer
  • Artificial intelligence (AI) and machine learning are especially important during which security information and event managemen
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!