write a program in java to input two nos. and find out the greater no.
Answers
Answered by
3
import java.util.Scanner;
public class Number
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int a,b;
System.out.println("Enter two numbers : ");
a=in.nextInt();
b=in.nextInt() ;
if (a>b)
System.out.println("First number is greater");
elseif (b>a)
System.out.println("Second number is greater");
else
System.out.println("Both the numbers are equal")
}
}
public class Number
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int a,b;
System.out.println("Enter two numbers : ");
a=in.nextInt();
b=in.nextInt() ;
if (a>b)
System.out.println("First number is greater");
elseif (b>a)
System.out.println("Second number is greater");
else
System.out.println("Both the numbers are equal")
}
}
LEARNINGSCIENCE:
Say me which portion is unclear
Answered by
2
import java.util.Scanner;
class Max_number
{
public static void main (String args[])
{
Scanner vi = new Scanner(System.in);
System.out.println(" Enter two numbers");
int num1 = vi.nextInt();
int num2 = vi.nextInt();
{
if (num1 >num2)
System.out.println(+num1+"is the greater number");
else
System.out.println(+num2+" is the greater number");
}}}
Similar questions