What does the following code snippet print?
Int a = 120;
Int b = 90;
Int n1 = Math.abs(a) ;
Int n2 = Math.abs(b) ;
Int result = 1;
For (int k = 1; k <= n1 && k <= n2; k++)
{
If (n1 % k == 0 && n2 % k == 0)
{
Result = k;
}
}
System.out.println(result) ;
A) 10
B) 20
C) 30
D) 40
Correct Answer:
Verified
Q38: What is the output of this code
Q39: When hand-tracing the loop in the code
Q40: In the _ loop header, you can
Q41: What does the method below return?
Int findSomething
Q42: Which of the following statements expresses why
Q44: What will be printed by the statements
Q45: Which statement about this code snippet is
Q46: What is the output of the following
Q47: What will be printed by the statements
Q48: Which of the following loops will print
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