what will ne the output ......
int y=5;
for (y<=19;y+=2)
System.out.println(y);
Answers
Answered by
19
OUTPUT :
5
7
9
11
13
15
17
19
↪ The initial value of y = 5 .
↪ The iteration value is y = y + 2 and hence y increases by 2 .
↪ The test condition is given y < = 19 .
↪ If the test condition is true , then only the loop is executed .
↪ If it is false , then it is terminated .
↪ In the above code , the value of y will begin from 5 and it will go n until the test condition is false .
↪ The test condition is false when y > 19 and hence the value of y will keep on increasing by 2 before it reaches more than 19 .
↪ The for-loop is given wrong in the question .
↪ The correct question will be :-
for (int y=5;y<=19;y+=2)
System.out.println(y);
↪ In the program y + = 2 means y = y + 2 .
↪ The + sign is the arithmetic operator used .
Answered by
0
hrdwsrxwgggffffgghhbmkjk
Similar questions
Environmental Sciences,
7 months ago
Math,
7 months ago
Social Sciences,
7 months ago
Math,
1 year ago