Advertisement
Guest User

CandyCount

a guest
Nov 18th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.34 KB | None | 0 0
  1. public class CandyCount {
  2.   public static void main(String[] args) {
  3.  
  4.    double money = 12.4;
  5.    double price = 1.2;
  6.    int candies = 0;
  7.  
  8.    if (money > 0 && price > 0 ) {
  9.         while ((money-price)>= 0) {
  10.             candies = candies + 1;
  11.             money = money - price;
  12.         }
  13.    }
  14.  
  15.     System.out.println("Candies: " + candies);
  16.   }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement