您的位置:首页 > 其它

两个整数的加减乘除

2015-10-08 17:53 169 查看
package test1;

import javax.swing.JOptionPane;

public class Test {

public static void main(String[] args ) {

// TODO 自动生成的方法存根

int n1=Integer.parseInt(JOptionPane.showInputDialog("Input number 1:"));

int n2=Integer.parseInt(JOptionPane.showInputDialog("Input number 2:"));

//获取从JOptionPane.showInputDialog对话框中的值,然后转换为int类型

JOptionPane.showMessageDialog(null, "The sum is:"+(n1+n2)

+"\n"+"The difference is:"+(n1-n2)

+"\n"+"The product is:"+(n1*n2)

+"\n"+"The division is:"+(n1/n2));

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: