📄 total5w.c
字号:
/*-*//******************************************************** * Program: ADD5 -- Adds up 5 numbers. * * * * Usage: * * Run it, type in 5 numbers and get a total. * ********************************************************//*+*/#include <stdio.h>int total; /* total of all the numbers */int current; /* current value from the user */int counter; /* while loop counter */char line[80]; /* Line from keyboard */int main() { total = 0; counter = 0; while (counter < 5) { printf("Number? "); fgets(line, sizeof(line), stdin); sscanf(line, "%d", ¤t); total += current; ++counter; } printf("The grand total is %d\n", total); return (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -