11172 - Relational Operator

本文介绍了一个简单的数值比较程序,该程序通过输入两组数值来确定它们之间的关系,并使用大于号(>)、小于号(<)或等于号(=)表示这种关系。此程序适用于基本的数值比较场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Some operators checks about the relationship between two values and these operators are called relational operators. Given two numerical values your job is just to find out the relationship between them that is (i) First one is greater than the second (ii) First one is less than the second or (iii) First and second one is equal.

 

Input

First line of the input file is an integer t (t<15) which denotes how many sets of inputs are there. Each of the next t lines contain two integers a and b (|a|,|b|<1000000001). 

 

Output

For each line of input produce one line of output. This line contains any one of the relational operators “>”, “<” or “=”, which indicates the relation that is appropriate for the given two numbers.

 

Sample Input                          Output for Sample Input

3
10 20
20 10
10 10

=

 

 

解题思路:水题,判断大小输出符号

#include<stdio.h>
int main()
{int n,n1,n2;
scanf("%d",&n);
while(n--){
           scanf("%d%d",&n1,&n2);
           if((n1-n2)>0)printf(">\n");
           else if((n1-n2)<0)printf("<\n");
           else if((n1-n2)==0)printf("=\n");
           }
return 0;
}

 

转载于:https://www.cnblogs.com/EVA00/archive/2013/02/07/2908580.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值