Computer Science, asked by kalluriamulya187, 5 hours ago


Which value(s) can be used to initialize i so that the
loop is finite:

public static void main (String[] args) {
for(int i=_;i>0;i=i%3)
{

System.out.print("*"');
}
}​

Answers

Answered by sequalsmd
8

Answer:

positive multiples of 3 i.e 3,6,9...

Explanation:

i%3 will return answer in the set {0,1,2}. For positive multiples of 3 the answer will be 0. 0 will activate for loop terminate condition.

Similar questions