题解 | #牛牛的单链表求和#

牛牛的单链表求和

https://www.nowcoder.com/practice/a674715b6b3845aca0d5009bc27380b5

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
   int n=0;
   scanf("%d",&n);
   int *p=NULL;
   p=(int *)malloc(sizeof(int));
   int sum=0;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&p[i]);
        sum+=p[i];
    }
    printf("%d",sum);
    return 0;
}

全部评论

相关推荐

点赞 评论 收藏
分享
吴offer选手:HR:我KPI到手了就行,合不合适关我什么事
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务