解题思路:
注意事项:
参考代码:import java.util.Scanner;
/**************题目 1088: A+B for Input-Output Practice (IV)**********************/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t=0;
int[] array = new int[100];
boolean tepm = true;
while (tepm) {
int n = sc.nextInt();
if(n != 0) {
int sum = 0;
for (int i = 0; i < n; i++){
int a = sc.nextInt();
sum+=a;
}
array[t++]=sum;
}else{
tepm = false;
}
}
for (int i = 0; i < t ; i++) {
System.out.println(array[i]);
}
}
}
0.0分
0 人评分
钟神赛车 (C语言代码)浏览:879 |
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:732 |
C语言训练-字符串正反连接 (C语言代码)浏览:622 |
九宫重排 (C++代码)浏览:1335 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:456 |
简单的a+b (C语言代码)浏览:340 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:605 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:575 |
WU-格式化数据输出 (C语言代码)浏览:1755 |
校门外的树 (C语言代码)浏览:702 |