Skip to content

Instantly share code, notes, and snippets.

@wilderwith
Last active October 21, 2019 20:38
Show Gist options
  • Save wilderwith/fd55f402ee8f3dda3f0c9b105d732103 to your computer and use it in GitHub Desktop.
Save wilderwith/fd55f402ee8f3dda3f0c9b105d732103 to your computer and use it in GitHub Desktop.
Quete Java 2
public class CandyCount {
public static void main(String[] a) {
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