1. 程式人生 > >java語言程式設計第十版程式設計練習題[1.5]

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); }
}