UVA 11172 discussRelational Operator

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

=

题意:第一行输入一个正整数t(t<12),表示测试数据的组数,判断这两个数的关系:i:>,ii:<,iii:=。

分析:用开关语句或者多重if语句。

AC源代码(C语言):

 1 #include<stdio.h>
 2 int main()
 3 {
 4           int t;
 5           long int a,b;
 6           scanf("%d",&t);
 7           while(t--)
 8               {
 9                   scanf("%ld%ld",&a,&b);
10                   if(a>b)  printf(">\n");
11                   else if(a<b)  printf("<\n");
12                   else printf("=\n");                         
13               }
14           return 0;        
15 }

2013-03-16

原文地址:https://www.cnblogs.com/fjutacm/p/2932727.html