标签:
一、求和代码
import java.util.Scanner;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int nextValue;
int sum = 0;
Scanner kbInput = new Scanner(System.in);
kbInput.useDelimiter("\s");
while(kbInput.hasNextInt()){
nextValue = kbInput.nextInt();
sum += nextValue;
}
kbInput.close();
System.out.println("sum = " + sum);
标签:
原文地址:http://www.cnblogs.com/liucong110/p/5402176.html