Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int count = scanner.nextInt();
- float[] numbers = new float[count];
- float sum = 0;
- int iterator = 0;
- if (count > 0) {
- while (iterator < count) {
- numbers[iterator] = Float.parseFloat(scanner.next());
- sum += numbers[iterator];
- iterator++;
- }
- System.out.printf("%.2f", sum / count);
- } else {
- System.out.print("0.00");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement