Skip to content

Instantly share code, notes, and snippets.

@JeromeBATAILLE
Created September 13, 2018 20:04
Show Gist options
  • Save JeromeBATAILLE/98148c26460de9c4b92b57d29f3b2f77 to your computer and use it in GitHub Desktop.
Save JeromeBATAILLE/98148c26460de9c4b92b57d29f3b2f77 to your computer and use it in GitHub Desktop.
De l'algorithmique au Java
class CandyCount {
public static void main(String[] args) {
double money = 12.4;
double price = 1.2;
int candies = 0;
if (money > 0 && price > 0) {
while ((money - price) >= 0) {
candies += 1;
money -= price;
}
}
System.out.println(candies);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment