解题思路:
知道你们都会,就是看着没有JAVA的题解,感觉不是太好,身为菜鸟的我补上。
注意事项:
比着葫芦画瓢。
参考代码:
import java.util.Scanner;
public class 问题1088 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
if (n == 0)
break;
else {
int a[] = new int[n];
int s = 0;
for (int i = 0; i < a.length; i++) {
a[i] = sc.nextInt();
s = s + a[i];
}
System.out.println(s);
}
}}}
0.0分
0 人评分