📜  奇偶在 c 中与三元运算符 - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:35.794000             🧑  作者: Mango

代码示例1
#include 
int main() {
    int num;
    printf("Enter an integer: ");
    scanf("%d", &num);
    // true if num is perfectly divisible by 2
   num % 2 == 0 ? printf("%d is even.", num); :  printf("%d is odd.", num);
    return 0;
}