Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Test111 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n1 = Integer.parseInt(scanner.nextLine());
- double average = 0;
- double min = 10000;
- double max = -10000;
- double sum = 0;
- for (int i = 0; i < n1; i++) {
- int n2 = Integer.parseInt(scanner.nextLine());
- if (n2 < min) {
- min = n2;
- }
- if (n2 > max) {
- max = n2;
- }
- sum = sum + n2;
- }
- average = sum / n1;
- System.out.printf("min=%.2f%n", min);
- System.out.printf("max=%.2f%n", max);
- System.out.printf("sum=%.2f%n", sum);
- System.out.printf("avg=%.2f", average);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement