Chef And Operators Codechef Solution

Hello coders, today we are going to solve Chef And Operators Codechef Solution. Which is a part of Codechef Solution.

Chef And Operators Codechef Solution
Chef And Operators Codechef Solution

Problem

Chef has just started Programming, he is in first year of Engineering. Chef is reading about Relational Operators.

Relational Operators are operators which check relationship 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 <= 10000000001

Example

Input:

3
10 20
20 10
10 10

Output:

<
>
=

Chef And Operators CodeChef Solution in Python

T = int(input())
while T > 0:
    m, n = map(int, input().split())
    if m > n:
        print(">")
    elif m < n:
        print("<")
    else:
        print("=")
    T = T - 1    

Chef And Operators CodeChef Solution in CPP

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

Chef And Operators CodeChef Solution in JAVA

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		for (int tc = 0; tc < T; tc++) {
			int A = sc.nextInt();
			int B = sc.nextInt();
			System.out.println(solve(A, B));
		}
		sc.close();
	}
	static char solve(int A, int B) {
		if (A < B) {
			return '<';
		} else if (A > B) {
			return '>';
		} else {
			return '=';
		}
	}
}

Disclaimer: The above Problem (Chef And Operators) is generated by CodeChef but the solution is provided by Chase2learn.This tutorial is only for Educational and Learning purpose.

Sharing Is Caring

Leave a Comment