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
Alex787 [66]
3 years ago
10

Consider the following two code segments. In both, assume that n is an integer variable that has been declared and initialized.

Segment 1 int prod = 1; int i; for (i = 2; i <= n; i++) { prod *= i; } System.out.println(prod); Segment 2 int prod = 1; int i = 2; while (i <= n) { prod *= i; i++; } System.out.println(prod); For which integer values of n do these code segments print the same result?
Computers and Technology
1 answer:
Ksivusya [100]3 years ago
6 0

Answer:

For every value of n.

Explanation:

In code segment 1 it uses for loop to store the product of integers from 2 to n in variable product it does that by using a for loop after that printing the product.

In the other code segment the same thing is done the only difference is that it uses a while loop instead of for loop to find the product and then printing the product.

So the result will be same for every value of n.

You might be interested in
Briefly describe the role of creativity and innovation to entrepreneurship​
prisoha [69]

Answer:

isia

Explanation:

Apooopooopeeepepe

8 0
3 years ago
Choose the comparison operator that will create a true statement in Scratch
andrew11 [14]

Answer:

The second option

90 > 85

The statement above means 90 is more than 85 which is true.

7 0
2 years ago
The purpose of technology is to solve problems and meet needs.<br><br> True or False
larisa [96]

Hello!

the answer is: True

Technology is used widely in many, many ways. from helping astronauts explore the cosmos, to allowing people to entertain themselves in their free time, technology has solved many problems and met many needs as intended

I hope this helps, and have a nice day!

3 0
3 years ago
Read 2 more answers
Microsoft excel is a ____application.
gavmur [86]
<span>Microsoft Excel is a spreadsheet developed by Microsoft for Windows, Mac OS X, Android and iOS.</span>
4 0
3 years ago
operating systems for mobile devices can support full-scale software programs like Microsoft Word or Excel
goldfiish [28.3K]
Mobile devices are unable to run full scale software programs like MS Word or Excel. They can run apps however with smaller capabilities as they require less hardware and specifications than the full version
The answer is false
7 0
3 years ago
Other questions:
  • Define a function SetTime, with int parameters hoursVal and minutesVal, that returns a struct of type TimeHrMin. The function sh
    7·1 answer
  • Which of the following is true of property?
    13·1 answer
  • Lenders always accept applications for credit
    10·1 answer
  • Imagine you are a toy designer. How would you use measuring, dimensions, volume, and surface area information to create your toy
    10·2 answers
  • Information systems include all of these
    5·1 answer
  • What finger should be on the Y key?
    12·2 answers
  • In this class, it is very common for your computer screen to look like this. What is this?​
    5·1 answer
  • Every workplace should have an emergency plan of action.
    15·2 answers
  • Meats ages hair and feathers all contain this monomer
    13·1 answer
  • Define a method calcPyramidVolume with double data type parameters baseLength, baseWidth, and pyramidHeight, that returns as a d
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!