I'm trying to calculate how many rounds can a player play lotto and joker games with a fixed amount of money.
public static void example () {
int money = 200;
int lottoCost = 4;
int jokerCost = 3;
int costTogether = lottoCost+jokerCost;
int rounds = 0;
for (int i = money; i <= 0; rounds++) {
money = money-costTogether;
}
System.out.println("With " + money + " euros, you can play "
+ rounds + " rounds.");
System.out.println("");
}
That code currently prints the text "With 200 euros, you can play 0 rounds." So it doesn't add a +1 to the rounds variable. What am I doing wrong?
moneyvariable.