通过输入第一个值 来决定后续输入的值中 有几个来参与运算

来源:互联网 发布:python排序函数 编辑:程序博客网 时间:2024/09/21 06:34
#include <stdio.h>#include <math.h>int main(){    int count, number, sum = 0;    printf("enter count: ");    scanf("%d", &count);//    fflush(stdin);    for (int i = count; i >= 1; i--){        scanf("%d", &number);        sum = sum + number;    }    printf("\n%d", sum);    return 0;}


0 0
原创粉丝点击