0

Need solution

Why the output is 121212? Explain please..... int value=10; for(int k=0; k<=2; k++) System.out.printf("%d",value+2);

9th Jan 2023, 10:10 PM
Mustakim Rahman
Mustakim Rahman - avatar
3 Answers
+ 4
Mustakim Rahman value is always 10 now think why 121212 Remember k = 0 to k <= 2 so loop runs 3 times
10th Jan 2023, 4:48 AM
A͢J
A͢J - avatar
+ 2
System.out.printf("%d ",value+2); // output is 12 12 12
9th Jan 2023, 11:39 PM
SoloProg
SoloProg - avatar
+ 1
Ohh... A͢J SoloProg Thats the matter
10th Jan 2023, 9:58 AM
Mustakim Rahman
Mustakim Rahman - avatar