UVA 11172 – Relational Operator

Really simple. Just a simple if-else.

import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 
 * @author Sanchit M. Bhatnagar
 * @see http://uhunt.felix-halim.net/id/74004
 * 
 */
public class P11172 {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    int N = Integer.parseInt(sc.nextLine());
    while (N > 0) {
      int X = sc.nextInt();
      int Y = sc.nextInt();
      if (X < Y) {
        out.println("<");
      } else if (X > Y) {
        out.println(">");
      } else {
        out.println("=");
      }
      N--;
    }
    out.close();
    sc.close();
  }

}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.