Computer Science, asked by Zain1893, 10 months ago

WAP in java to find which no. Is bigger

Answers

Answered by shreshtha3195
0

Answer:

using scanner

import java.util.*

public class Bigger

{

public static void main ( String args [])

{

scanner in =new scanner (system.in);

int a,b

System.out.print ( "Enter two numbers:")

a=in.nextInt();

b=in.nextInt();

if (a>b)

{

System.out.print (a+"is greater number");

}

else

{

system.out.println ( b+" is greater number");

}

}

} if you want to use function argument or input stream reader you can just edit the syntax

Answered by anindyaadhikari13
1

\star\:\:\:\sf\large\underline\blue{Question:-}

  • Write a program in Java to find which number is bigger.

\star\:\:\:\sf\large\underline\blue{Code:-}

In this code, we will compute largest among two numbers.

import java.util.*;

class BiggerOne

{

public static void main(String s[])

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter first number: ");

int a=sc.nextInt();

System.out.print("Enter second number: ");

int b=sc.nextInt();

if(a==b)

System.out.println("Both are equal. ");

else if(a>b)

System.out.println("First number is greater than second. ");

else

System.out.println("Second number is greater than the first number.");

}

}

Similar questions