Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Apple Banana Pear question
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int banana = 6; int apple = 3; int pear = 5; for (int i = 0; i < 10; i++) { for (int j = 0; j <10; j++) for (int k = 0; k < 10; k++) { int cost = banana * i + apple * j + pear * k; if (cost == 52 && j == k && i+j+k==10) { System.out.println("Banana: " + i); System.out.println("Apple: " + j); System.out.println("Pear: " + k); } } } } }
run
|
edit
|
history
|
help
0
Duplicate in string
2darray
Решето Эратосфена
Word pattern
Fgh
getListVehicules
th
boolean1
4th ques
Coding Numbers - Duplicate - Array