Q. What is the output of the below java program that implements nesting of loops?

Code:
int i=1, j=1;
while(i<3)
{
  do
  {
    System.out.print(j + ",");
    j++;
  }while(j<4);
  i++;
}
  • (A) 1,2,3,4,1,2,3,4,
  • (B) 1,2,3,4,
  • (C) 1,2,3,1,2,3,
  • (D) 1,2,3,
πŸ’¬ Discuss
βœ… Correct Answer: (B) 1,2,3,4,

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
272
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
93%
Success Rate