C 寫一個宏輸出兩個數中較大的數

1.程序代碼

#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <Windows.h>

#define MAX(a, b) ((a) > (b) ? (a) : (b))

int main()
{
    int x = 0;
    int y = 0;

    printf("請輸入兩個數字:");
    scanf("%d %d", &x, &y);

    printf("%d\n", MAX(x, y));

    system("pause");
    return 0;
}

2.執行結果

這裏寫圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章