Expert in study
alarm
Ask
Computer Science
Richie Richie Jan 15, 2021

Write a program to input 10 integers and display the largest as well as the smallest integerPLEASE GIVE ANSWER IN JAVA.....​

answers: 1
Register to add an answer
The time for answering the question is over
Answer:

if(i==0&&num>0)

small=num;

if(num<small)

small=num;

System.out.println(small);

}

d get the largest without using arrays but, unable to get the smallest one.

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 n numbers

402
offer offer
Jan 15, 2021
For answers need to register.
Contacts
mail@expertinstudy.com
Feedback
Expert in study
About us
For new users
For new experts
Terms and Conditions