Computer Science, asked by shashwatprathmesh8, 6 months ago

write a program in Java to input 10 numbers and display greatest and smallest among them​

Answers

Answered by aksharaagarwal22may2
4

Answer:

public static void main(String[] args)

{

int smallest=0;

int large=0;

int num;

System.out.println("enter the number");

Scanner input=new Scanner(System.in);

int n=input.nextInt();

for(int i=0;i<n;i++)

{

num=input.nextInt();

if(num>large)

{

large=num;

}

System.out.println("the largest is:"+large);

//gives the largest number in

Answered by MrArpitS1706
0

Answer:

below

Explanation:

public static void main(String[] args)

{

int smallest=0;

int large=0;

int num;

System.out.println("enter the number");

Scanner input=new Scanner(System.in);

int n=input.nextInt();

for(int i=0;i<n;i++)

{

num=input.nextInt();

if(num>large)

{

large=num;

}

System.out.println("the largest is:"+large);

//gives the largest number in

Similar questions