Relationship between two numbers【2】

来源:互联网 发布:金玉满堂 知乎 编辑:程序博客网 时间:2024/06/02 04:05

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<stdio.h>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;}
0 0