- Category:
- Java Develop
- Tags:
-
[Text]
- File Size:
- 1kb
- Update:
- 2014-04-15
- Downloads:
- 0 Times
- Uploaded by:
- 里斯坚
Description: 7 8 9 10 11 12 13 14 15 16 17 18 // 帮你弄了一个 你可以去试试
import java.util.Scanner
public class JsAvg {
public static void main(String[] args) {
System.out.println("请依次输入数字用空格分隔,输入0结束")
Scanner in = new Scanner(System.in)
double n, sum = 0, count = 0
while (true) {
n = in.nextDouble()
if (n == 0.0)
break
sum+= n
count+= 1
}
System.out.println("平均数为:"+ sum/count)
}
}
To Search:
File list (Check if you may need any files):
qq.txt
aa.txt
ww.txt