版权声明:071623 https://blog.csdn.net/weixin_43584220/article/details/88926392
package cn.LanQiaoBeiAlgorithm.Ravanla;
/**
* 浮点数
* @author Ravanlala
*啤酒2.3一瓶,饮料1.9一瓶,我有82.3元分别能买多少瓶啤酒和饮料
*/
public class BeerAndDrinks {
public static void main(String[] args) {
for(int i = 0; i < 100; i++) {
for(int j = 0; j < 100; j++) {
// if(i * 2.3 + j* 1.9 == 82.3)System.out.println(i + "," + j);
// if(i * 23 + j* 19 == 823)System.out.println(i + "," + j);
if((Math.abs(i * 2.3 + j* 1.9 - 82.3) < 1E-6))System.out.println(i + "," + j);
}
}
}
}