Ask Question
17 November, 13:09

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

+5
Answers (1)
  1. 17 November, 13:26
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers