首页 >计算机类 >JAVA认证 > >比较两个数的大小,找出其中的最小数并输出。

比较两个数的大小,找出其中的最小数并输出。

时间:2019-10-25 07:37浏览次数:

参考答案

答案:import java.io.*;public class ka{ public static void main(String[] args) throws IOException{float? x,y,m;m=0;InputStreamReader readerx=new InputStreamReader(System.in);BufferedReader inputx=new BufferedReader(readerx);System.out.println("请输入x:");String tempx=inputx.readLine();x = Float.parseFloat(tempx);InputStreamReader readery=new InputStreamReader(System.in);BufferedReader inputy=new BufferedReader(readery);System.out.println("请输入y:");String tempy=inputy.readLine();y= Float.parseFloat(tempy);if(x{m=x;}else{m=y;}System.out.println("最小数为"+m);}}

    阅读排行