Chef And Operators: CHOPRT
Chef And Operators CodeChef Solution
Public Submission link: Click here (anyone can submit here )
CU Submission link: Click here (need login by CU account)
Chef has just started Programming, he is in first year of Engineering. Chef is reading about Relational Operators.
Relational Operators are operators which check relatioship between two values. Given two numerical values A and B you need to help chef in finding the relationship between them that is,
First one is greater than second or, First one is less than second or, First and second one are equal.
Input
First line contains an integer T, which denotes the number of testcases. Each of the T lines contain two integers A and B.
Output
For each line of input produce one line of output. This line contains any one of the relational operators
‘<‘ , ‘>’ , ‘=’.
Constraints
1 ≤ T ≤ 10000 1 ≤ A, B ≤ 1000000001
Sample Input 1
3
10 20
20 10
10 10
Sample Output 1
<
>
=
Explanation
In this example 1 as 10 is lesser than 20
Chef And Operators CodeChef Solution in C
// your code goes here
int t;
scanf("%d",&t);
while(t--)
{
int a,b;
scanf("%d %d",&a,&b);
if(a < b)
printf("\n<");
else if(a>b)
printf("\n>");
else
printf("\n=");
}
return 0;
}
Chef And Operators CodeChef Solution in C++ 14
// your code goes here
int t , x ,y ;
cin >>t ;
while(t--) {
cin >> x >>y ;
if ( x >y )
cout << ">" << endl ;
else if ( x < y )
cout << "<" << endl ;
else
cout << "=" << endl ;
}
return 0;
}
Chef And Operators CodeChef Solution in Python 3
for _ in range(int(input())):
num1, num2 = (map(int, input().split()))
if num1 < num2:
print("<")
elif num1 > num2:
print(">")
else:
print("=")
Chef And Operators CodeChef Solution in Java
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int x=sc.nextInt();
int y=sc.nextInt();
if(x < y)
{
System.out.println("<");
}
else if(x>y)
{
System.out.println(">");
}
else
{
System.out.println("=");
}
}
}
}
More Codechef Solution: Click Here
Chef And Operators CodeChef Solution