Relationship between two numbers【2】

Relationship between two numbers【2】


The task is very simple, you need to compare two integers input by the user:
I will input two integers a and b, if a < b, you need to print “a is less than b”; if a > b, you need to print “a is greater than b”; if a = b, you need to print “a is equal to b”.

for example:

input

3 4

output

3 is less than 4


代码
#include
int main() {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a < b) {
        printf("%d is less than %d\n", a, b);
    }
    else if (a > b) {
        printf("%d is greater than %d\n", a, b);
    }
    else if (a = b) {
        printf("%d is equal to %d\n", a, b);
    }
    return 0;
}

你可能感兴趣的:(c语言)