编程中的错误:
System.out.println("%d个数的何为%f\n",m,sum);
就会提示出现错误
import java.util.*;
public class Example
{
public static void main(String args[])
{
Scanner reader=new Scanner(System.in);
double sum=0;
int m=0;
while(reader.hasNextDouble())
{
double x=reader.nextDouble();
m=m+1;
sum+=x;
}
System.out.printf("%d个数的何为%f\n",m,sum);
}
}
阅读(304) | 评论(0) | 转发(0) |