Ask Question
31 March, 16:12

What is the output of the following code: for (loop = 1; loop <3; + +loop) System. out. print (1); for (loop2 = 1; loop2<3; + +loop2) System. out. print (2);

+1
Answers (1)
  1. 31 March, 17:45
    0
    The output of the given code as follows:

    Output:

    1122

    Explanation:

    In the given java code the two for loop is defined, which can be described as follows:

    In the first loop, a"loop" variable is used, which starts from 1 and ends when the value of loop is less than 3, inside the loop a print function is used, that print value 1. In the next step, another for loop is declared, inside the loop a variable "loop2" variable is used, that's working is the same as the above loop, but in this loop, it will print a value, that is 2.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What is the output of the following code: for (loop = 1; loop ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers