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
ira [324]
3 years ago
14

What will be the result of running the following code fragment? int year = 0; double rate = 5; double principal = 10000; double

interest = 0; while (year < 10) { interest = (principal * year * rate) / 100; System.out.println("Interest " + interest); }
Computers and Technology
1 answer:
NemiM [27]3 years ago
5 0

Answer:

This code fragment will run an infinite loop

Explanation:

This output: Interest 0.0 Will be displayed infinitely. The reason is because the variable year which is initially set to 0 is never updated and as such remains true because the condition is while(year<10). So at the first iteration the statement interest = (principal * year * rate) / 100; evaluates to 0 and this line of code System.out.println("Interest " + interest); prints Interest 0.0. At the next iteration the same evaluation and output takes place and on and on and on....... since the control variable is not changing.

You might be interested in
Today's Apple Mac computers run with the same I-Ternal hardware as the Windows based PC true or false
Ksivusya [100]
Kinda of both. The processor, memory, hard drive and displays are all standard components and are provided by a variety computer competent manufacturers (except for the processors which are all supplied by Intel). Yet - while many components are standard - NO, the core, hardware components, like logic boards (motherboard), video cards, and other specialty components (some display connectors and displays, for example) are propriety Apple designs.
5 0
3 years ago
How many wins does ninja have :/
den301095 [7]

Answer:

he played 13,500 games and has 37 percent win rate

5 0
3 years ago
Is ROBLOX for kids?<br><br> A: Yes<br><br> B: No
Annette [7]
ROBLOX is for everyone
8 0
4 years ago
Read 2 more answers
PLEASE HELP!!! Me turn this into a video &amp; add liana flores- raise the moon (instrumental) in the background for the music.
Marina CMI [18]

Answer:

Try going to your settings and allow output camera

Explanation:

5 0
2 years ago
Read 2 more answers
Can you guys help me with this coding assignments?
kicyunya [14]

Explanation:

x ==50

while x< 100;

x -= 1

8 0
3 years ago
Other questions:
  • What is the portion of the PowerPoint window that contains the current slide, total slides, zoom options, and various shortcuts
    8·1 answer
  • Any game suggestions for nintindo switch.​
    10·1 answer
  • What is the maximum rate at which computers A and B can communicate, via router X? (your answer should be in Mbps)
    12·1 answer
  • Is data mining a simple transformation or application of technology developed from databases, statistics, machine learning, and
    12·2 answers
  • A cable that connects the computer to the printer is an example of<br> A.hardware<br> B.software
    13·2 answers
  • What is the use of comma and semicolon with print statement ?​
    11·1 answer
  • A client calls to complain that his computer starts up, but crashes when Windows starts to load. After a brief set of questions,
    13·1 answer
  • Answer to this problem
    11·1 answer
  • Who when and why developed python​
    9·2 answers
  • Why is it important to prepare the farm resources before you start working? explain​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!