Computer Science, asked by alivia07, 1 year ago

write a program in java to input two nos. and find out the greater no.​

Answers

Answered by LEARNINGSCIENCE
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")

}
}

LEARNINGSCIENCE: Say me which portion is unclear
LEARNINGSCIENCE: If you are an icse student, buy the book, understanding computer applications (with BlueJ) [ARYA PUBLISHING COMPANY]
LEARNINGSCIENCE: Dilip kumar dey
LEARNINGSCIENCE: Is the author
alivia07: ok
alivia07: thank you
LEARNINGSCIENCE: Welcome mam
Answered by Monika010
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");

}}}


LEARNINGSCIENCE: Give the remaining quote at the last printing statement
LEARNINGSCIENCE: Its missing dear
LEARNINGSCIENCE: Still now mistakes mam
LEARNINGSCIENCE: Its not necessary to give "+" before a printing statement
LEARNINGSCIENCE: Plz remove it
Similar questions