A

Admin • 828.43K Points
Coach

Q. What is the output of this code?
for(int i=1;i<=3;i++){
for(int j=1;j<=2;j++){
System.out.print("*");
}
}

  • (A) ****
  • (B) ******
  • (C) ***
  • (D) **
  • Correct Answer - Option(B)
  • Views: 14
  • Filed under category Java
  • Hashtags: Java Loops

Explanation by: Admin
The inner loop runs 2 times per outer iteration. 3x2 = 6 stars.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.