Created
June 4, 2022 15:32
-
-
Save MP-C/070c15768932fbef4975978a0a3e8874 to your computer and use it in GitHub Desktop.
Java 02 Algrithmique
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CandyCount { | |
public static void main(String[] args) { | |
double realMoney = 12.4; | |
double realPrice = 1.2; | |
int candies = 0; | |
if (realMoney > 0 && realPrice > 0){ | |
while ((realMoney - realPrice) >= 0) { | |
candies = candies + 1; | |
realMoney = realMoney - realPrice; | |
} | |
System.out.println(candies); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment