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
Wewaii [24]
3 years ago
13

What does the following fragment of code display? What do you think the programmer intended the code to do, and how would you fi

x it? int product = 1; int max = 20; for (int i = 0; i <= max; i++) product = product * i; System.out.println("The product is " + product);
Computers and Technology
1 answer:
postnew [5]3 years ago
8 0

Answer:

0

Explanation:

Given the code segment:

  1.        int product = 1;
  2.        int max = 20;
  3.        for (int i = 0; i <= max; i++)
  4.            product = product * i;
  5.        System.out.println("The product is " + product);

Since the counter i in the for loop started with 0, and therefore <em>product * i </em>will always be 0 no matter how many rounds of loop to go through.

The code is likely to perform factorial calculation. To do so, we need to change the starting value for the counter i to 1.

  1.        int product = 1;
  2.        int max = 20;
  3.        for (int i = 1; i <= max; i++)
  4.            product = product * i;
  5.        System.out.println("The product is " + product);

You might be interested in
File-sharing programs such as Napster, Kazaa, and iMesh make it possible for individuals to exchange music files over the Intern
Mashutka [201]

Answer:

Option A) Demand for CDs has decreased, causing equilibrium price and quantity to decrease.

is the correct answer.

Explanation:

  • File-sharing is a common practice nowadays. It helps us by providing access to different files (audio , video, images, documents) to others in a faster way.
  • A wide range of files are shared daily by using different means of file-sharing including computer networks and peer-to-peer networking.
  • Formerly, the data was shared using CDs but now this system has been replaced with the advent of internet.
  • Usage of CDs is dropped drastically and hence their demand is decreased.
  • So now the prices of CDs are not in equilibrium and their quantity is also decreased.

i hope it will help you!

3 0
3 years ago
How to write conclusion of hard disk​
sergeinik [125]

Answer:

el disco duro es un componte de almacenamiento de una pc, su uso es de guardar archivos también como el sistema operativo de ejemplo :linux, window ,mac etc

Explanation:

7 0
2 years ago
You visit two websites about inventions of the 21st century. One has .edu in the URL address and the other has .com. Which site
Kobotan [32]
Since you are searching for researching information, .edu will be more reliable.

.edu is for education purpose, with credits of scholars.

.com is a general URL, it's not relavant to reliability.
4 0
2 years ago
Read 2 more answers
How do I change my username/display name
exis [7]

Answer:

.

Explanation:

you do to me on the bottom bar and once you hit that you click the pencil and change it

6 0
3 years ago
Read 2 more answers
(e) The entries in each column of the array A are sorted into strictly increasing order.
gizmo_the_mogwai [7]
The answer is 3 because
5 0
2 years ago
Other questions:
  • You specify the shape of an oval in a Java applet by defining the oval's:__________.
    5·1 answer
  • When considering changing the content of a cell which button should you press to leave the cell as it originally was? 
    5·1 answer
  • The Internet may best be compared to a/an
    11·1 answer
  • sandra has houseplants sitting on her kitchen windowsill, where it receives a lot of sunlight . what will most likely be the pla
    9·2 answers
  • Which areas of a business would most benefit from using the Workday platform?
    7·1 answer
  • Math and science are the foundation from which drafters work<br><br> True<br> False
    8·1 answer
  • Write steps for converting decimal to binary numbers?
    13·1 answer
  • Sample outputs with inputs 9 5 2 -1 in python.
    8·1 answer
  • Describe accessibility in Windows 7 ​
    13·1 answer
  • Which iteration must have an expression that has a true or false value?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!