1. 程式人生 > >A+B for Input-Output Practice

A+B for Input-Output Practice

import java.util.Scanner;
public class Main {
    public static void main(String args[]) {
        Scanner input=new Scanner(System.in);
        int n,a,i;
        int t=input.nextInt();
        do {
            int sum=0;
            n=input.nextInt();
            for(i=1;i<=n;i++){
              a=input.nextInt();
              sum+=a;
            }
            System.out
.println(sum); System.out.print("\n"); }while(--t>0); } }