Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.text.DecimalFormat;
- import java.util.Scanner;
- public class avereg {
- 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++) {
- sum += Double.parseDouble(entry1.nextLine());
- //sum = sum + numbers;
- //result = sum / n;
- }
- double result = sum/n;
- System.out.print(df2.format(result));
- //System.out.printf()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement