#include <stdio.h>
#include <stdlib.h>int main()
{int n,i,sum=0,a;scanf("%d",&n);for (i=1;i<=n;i++){scanf("%d",&a);sum+=a;}printf("%d\n",sum);return 0;
}
详细解决方案
【1333】n个数求和
热度:16 发布时间:2023-12-06 10:01:24.0
#include <stdio.h>
#include <stdlib.h>int main()
{int n,i,sum=0,a;scanf("%d",&n);for (i=1;i<=n;i++){scanf("%d",&a);sum+=a;}printf("%d\n",sum);return 0;
}