6.16.14

 循环输入时好像还有点没达到要求,还要再做修改
// 6.16.14
#include <stdio.h>
int main(void)
{
    double arrayone[8];
    double arraytwo[8];
    int loop;

    for (loop = 0; loop < 8; loop++)
    {
        printf("请输入第%d个值:", loop + 1);
        scanf("%lf", &arrayone[loop]);
    }   
    for (loop = 0; loop < 8; loop++)
    {
        printf("%9f ", arrayone[loop]);
    }
    printf("\n");
    for (loop = 1; loop < 8; loop++)
    {
        arraytwo[0] = arrayone[0];
        arraytwo[loop] = arraytwo[loop - 1] + arrayone[loop];

    }

    for (loop = 0; loop < 8; loop++)
    {
        printf("%9f ", arraytwo[loop]);
    }
    return 0;
}
posted on 2019-03-27 22:02  viviLy  阅读(112)  评论(0编辑  收藏  举报