判断输入的各个数字是奇数还是偶数

#include 

int even(int);

int main(){
    int figure;
    printf("please enter a sieral integer(-1 to end):");
    scanf("%d", &figure);
    while (figure != -1){
        if (1 == even(figure))
            printf("this figure is a even!\n");
        else
            printf("this figure is a odd!\n");

        scanf("%d", &figure);
    }
    return 0;
}

int even(int x){
    return !(x % 2);
}

你可能感兴趣的:(代码练习)