Skip to content

Instantly share code, notes, and snippets.

@stephanBerger
Last active August 27, 2019 19:36
Show Gist options
  • Save stephanBerger/eaff65e506f5d846e7eca62c5131d619 to your computer and use it in GitHub Desktop.
Save stephanBerger/eaff65e506f5d846e7eca62c5131d619 to your computer and use it in GitHub Desktop.
public 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++;
money-=price;
}
}
System.out.println(candies);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment