Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.text.DecimalFormat;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- DecimalFormat df2 = new DecimalFormat("0.00");
- Scanner entry1 = new Scanner(System.in);
- Scanner entry2 = new Scanner(System.in);
- double n = Double.parseDouble(entry1.nextLine());
- double numbers;
- double sum = 0;
- double result = 0;
- for (int i = 1; i <= n; i++) {
- numbers = Double.parseDouble(entry2.nextLine());
- sum = sum + numbers;
- result = sum / n;
- }
- System.out.print(df2.format(result));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement