Easy Tutorial
❮ C Function Frexp C Function Strpbrk ❯

C Exercise Example 48

C Language Classic 100 Examples

Title: Macro #define Command Practice 3.

Program Analysis: None.

Program Source Code:

//  Created by www.tutorialpro.org on 15/11/9.
//  Copyright © 2015 tutorialpro.org. All rights reserved.
//

#define LAG >
#define SMA <
#define EQ ==
#include <stdio.h>
int main()
{
    int i,j;
    printf("Please enter two numbers:\n");
    scanf("%d %d",&i,&j);
    if(i LAG j)
        printf("%d is greater than %d \n",i,j);
    else if(i EQ j)
        printf("%d is equal to %d \n",i,j);
    else if(i SMA j)
        printf("%d is less than %d \n",i,j);
    else
        printf("No value.\n");
    return 0;
}

Output of the above example:

Please enter two numbers:
1 2
1 is less than 2

C Language Classic 100 Examples

❮ C Function Frexp C Function Strpbrk ❯