Skip to content

Instantly share code, notes, and snippets.

@Skoatpalace
Created September 10, 2018 15:31
Show Gist options
  • Save Skoatpalace/017c7fcf0a1abe03e0885986ec51b9e3 to your computer and use it in GitHub Desktop.
Save Skoatpalace/017c7fcf0a1abe03e0885986ec51b9e3 to your computer and use it in GitHub Desktop.
CandyCount.java
class candyCount {
public static void main(String[] args) {
double HaveMoney = 12.4;
double IsPrice = 1.2;
int NbCandies = 0;
if ((HaveMoney > 0) && (IsPrice > 0)) {
while ((HaveMoney - IsPrice) >= 0) {
NbCandies = (NbCandies + 1);
HaveMoney = (HaveMoney - IsPrice);
}
}
System.out.println(NbCandies);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment