Draw a flow chart to find biggest and smallest of N given number
Answers
Answered by
0
Answer:
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("how many numbers are there?");
int n = sc.nextInt();
int[] numbers = new int[n];
System.out.println("Enter all " + n + " numbers-");
for(int i = 0; i < n; i++){
numbers[i] = sc.nextInt();
}
Arrays.sort(numbers);
System.out.println("The smallest number is " + numbers[0]);
System.out.println("The largest number is " + numbers[n-1]);
}
}
Explanation:
Similar questions
Computer Science,
2 months ago
Hindi,
2 months ago
English,
5 months ago
World Languages,
10 months ago
Math,
10 months ago