import java.util.*;
public class readFloat
{
public static void main(String args[])
{
float num1=0;
float num2=0;
Scanner reader=new Scanner(System.in);
System.out.println("请输入两个单精度数,然后输入=号结束");
while(reader.hasNextFloat())
{
num1=reader.nextFloat();
num2=reader.nextFloat();
}
System.out.printf("和为:%f\n",num1+num2);
System.out.printf("差为:%f\n",num1-num2);
System.out.printf("积为:%f\n",num1*num2);
System.out.printf("商为:%f\n",num1/num2);
}
}
这样就可以计算了!!!