add10.c

来自「The art and science of c_source code!」· C语言 代码 · 共 27 行

C
27
字号
/* * File: add10.c * ------------- * This program adds a list of ten numbers, printing * the total at the end.  Instead of reading the numbers * into separate variables, this program reads in each * number and adds it to a running total. */#include <stdio.h>#include "genlib.h"#include "simpio.h"main(){    int i, value, total;    printf("This program adds a list of ten numbers.\n");    total = 0;    for (i = 0; i < 10; i++) {        printf(" ? ");        value = GetInteger();        total += value;    }    printf("The total is %d\n", total);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?