addlist.c
来自「The art and science of c_source code!」· C语言 代码 · 共 27 行
C
27 行
/* * File: addlist.c * --------------- * This program adds a list of numbers. The end of the * input is indicated by entering 0 as a sentinel value. */#include <stdio.h>#include "genlib.h"#include "simpio.h"main(){ int value, total; printf("This program adds a list of numbers.\n"); printf("Signal end of list with a 0.\n"); total = 0; while (TRUE) { printf(" ? "); value = GetInteger(); if (value == 0) break; total += value; } printf("The total is %d\n", total);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?