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) ;
}
A) The code fragment will display the interest calculated for nine years.
B) The code fragment will continue to display the calculated interest forever because the loop will never end.
C) The code fragment will not display the calculated interest and halt abruptly.
D) The code fragment will not display any output because it will not compile.
Correct Answer:
Verified
Q17: What is the output of the following
Q18: How many times will the following loop
Q19: What is the output of the following
Q20: What is the output of the code
Q21: What is the output of the code
Q23: What are the values of i and
Q24: Which of the following code snippets displays
Q25: How many times does the following code
Q26: How many times does the loop execute
Q27: What is the output of the code
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents