Solved

What Does the Following Code Snippet Print

Question 28

Multiple Choice

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions