杭电ACM 1092(A+B for Input-Output Practice (IV))

杭电ACM 1092(A+B for Input-Output Practice (IV))_第1张图片

杭电ACM 1092(A+B for Input-Output Practice (IV))_第2张图片

#include<iostream>
using namespace std;
int main()
{
    int n,sum;
    while(cin>>n&&n!=0)
    {
      sum=0;
     int *num=new int[n];
     for(int i=0;i<n;i++)
     {
        cin>>num[i];
     }
     for(i=0;i<n;i++)
     {
         sum+=num[i];
     }
     cout<<sum<<"\n";
    }
}


 

你可能感兴趣的:(杭电ACM 1092(A+B for Input-Output Practice (IV)))