iseven.c

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

C
39
字号
/* * File: iseven.c * -------------- * This program prints a list of the even numbers between * 1 and 10.  In an ideal implementation, constants would * be used for the limits, but this program is designed to * match the program example in the text. */#include <stdio.h>#include "genlib.h"/* Function prototypes */bool IsEven(int n);/* Main program */main(){    int i;    for (i = 1; i <= 10; i++) {        if (IsEven(i)) printf("%2d\n", i);    }}/* * Function: IsEven * Usage: if (IsEven(n)) . . . * --------------------------- * This function returns TRUE if n is even. */bool IsEven(int n){    return (n % 2 == 0);}

⌨️ 快捷键说明

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