Ask Question
16 August, 07:47

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);

+2
Answers (1)
  1. 16 August, 10:27
    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?
Get an answer to your question ✅ “What is the output of the following code: for (loop = 1; loop ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers