Skip to content

Instantly share code, notes, and snippets.

@Cynnah
Last active June 21, 2021 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cynnah/e16b93b39ab3026059bfa679b0658150 to your computer and use it in GitHub Desktop.
Save Cynnah/e16b93b39ab3026059bfa679b0658150 to your computer and use it in GitHub Desktop.
Java 02 WCS quest
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 = candies + 1;
money = money - price;
}
}
System.out.println(candies);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment