close

import javax.swing.JOptionPane;
public class PrintVAR {
    public static void main(String args[])
    {
        double a=5,b=3.14,c ; //宣告變數並設定起始值
        String d ; //儲存使用者輸入的字串
        d = JOptionPane.showInputDialog("輸入半徑");
        a = Integer.parseInt(d);
        c = b*a*a;//計算圓面積
        System.out.println("r = " + a); //輸出半徑
        System.out.print("Area = " + c); //用 + 運算子,串聯字串與變數
    }
}

 


 

 

 

arrow
arrow
    文章標籤
    Java
    全站熱搜
    創作者介紹
    創作者 陰界黑幫 的頭像
    陰界黑幫

    巨獸 逆襲

    陰界黑幫 發表在 痞客邦 留言(0) 人氣()