import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); //write your code here...... int n = 0; int sum = 0; float i = 0.0f; double average = 0.0; //输出格式为:System.out.println(String.format("%.2f",avg)); while(scan.hasNextInt()){ n = scan.nextInt(); if (n < 0){ break; }else{ i++; sum += n; } } average = sum / i; System.out.println(String.format("%.2f",average)); } }