Write a C-program to print relation of two numbers

Write a C-program to print relation of two numbers

Program
public class Main
{
	public static void main(String args[])
	{
        int x=10,y=20;
        boolean z;
        z=x>y;
        System.out.println("z value is: "+(z));
	}
}	

Output:

z value is: false

Using CommandLine Arguments
public class Main
{
	public static void main(String args[])
	{
        int x,y;
        boolean z;
        x=Integer.parseInt(args[0]);
        y=Integer.parseInt(args[1]);
        z=x>y;
        System.out.println("z value is: "+(z));
	}
}	

Output:

z value is: false

Using Scanner Class
import java.util.*;
public class Main
{
	public static void main(String args[])
	{
        int x,y;
        boolean z;
        Scanner s=new Scanner(System.in);
        System.out.println("Enter x,y values");
        x=s.nextInt();
        y=s.nextInt();
        z=x>y;
        System.out.println("z value is: "+(z));
	}
}	

Output:

Enter x,y values
10
20
z value is: false





More Questions


13 . Write a java-program to print relation of two numbers
14 . Write a Java-program to print logical operators program using &&, || ,!
15 . Write a Java-program to print bitwise AND operation
16 . Write a Java-program to print bitwise OR operation
17 . Write a Java-program to print bitwise CAP operation
18 . Write a Java-program to print bitwise NEGATION operation
19 . Write a Java-program to print bitwise LEFT SHIFT operation
20 . Write a Java-program to print bitwise RIGHT SHIFT operation
21 . Write a Java-program to print odd or even number using ternary operator
22 . Write a Java-program to print max number using ternary operator
23 . Write a Java-program to print MAX Number Amoung 3 Numbers