java语言程序设计第十版编程练习题[1.5]

(计算表达式)编写程序,显示以下公式的结果。

  9.5×4.5-2.5×3
—————————————————
    45.5-3.5
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package dome1_5;

/**
 *
 * @author Administrator
 */
public class Dome1_5 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        double calculate = 0.0;
        calculate = (9.5 * 4.5 - 2.5 * 3) / (45.5 - 3.5);
        System.out.println(calculate);
    }
    
}

猜你喜欢

转载自blog.csdn.net/weixin_40476031/article/details/85760290
今日推荐