题解 | #牛牛的新数组求和#
牛牛的新数组求和
http://www.nowcoder.com/practice/bdd2cd6638f849cfa06216198e8eb967
#include <stdio.h>
int cal(intarray,int n) { int i = 0; int sum = 0; while(i<n) { sum+=((array+i)); ++i; } return sum; } int main() { int n = 0; int array[100] = {0}; scanf("%d",&n); getchar(); int m = 0; for(;m<n;++m) { scanf("%d",&array[m]); } printf("%d",cal(array,n)); return 0; }