int num=0;
int count=0;
while (num++<100)
{
if(num%5!=0 || num%7!=0)
continue;
count++;
System.out.println(num);
}
System.out.print("count : " + count);
}
}
//If you're looking at the example for countinue and you want '(num%5!=0 || num%7!=0)' divided by 5 and the rest is non-zero, then 6, 7, 8, 9, 11...Shouldn't the price be this way? I don't understand why the answer is 35, 70, count: 2
If you meet continue, ignore the next sentence and jump back to while.
That is, it does not count++.
while (num++<100)
{
if(num%5!=0 || num%7!=0)
continue;
count++;
System.out.println(num);
}
If you look inside the sentence, divide by 5 or 7, and the rest is either 0 or continue That is, the syntax below is no longer executed, increasing num by 1 and then running while again.
That is, when divided by 5 and 7, find the remainder of the argument -> 5 and 7 common multiple.
© 2024 OneMinuteCode. All rights reserved.