Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

C Exercise 48

C Exercise 48

100 Classic C Language Examples 100 Classic C Language Examples

**Problem:** Practice the macro #define command 3.

**Analysis:** None.

Program source code:



//  Created by www.runoob.com on 15/11/9.

//  Copyright © 2015 Runoob Tutorial. All rights reserved.

//



#define LAG >

#define SMA <

#define EQ ==

#include 

int main()

{

    int i,j;

    printf("请输入两个数字:\n");

    scanf("%d %d",&i,&j);

    if(i LAG j)

        printf("%d 大于 %d \n",i,j);

    else if(i EQ j)

        printf("%d 等于 %d \n",i,j);

    else if(i SMA j)

        printf("%d 小于 %d \n",i,j);

    else

        printf("没有值。\n");

    return 0;

}

The output of the above example is:



Please enter two numbers:

1 2

1 小于 2 

100 Classic C Language Examples 100 Classic C Language Examples