|
|
вернуться в форумeasy[Java] cycle for,no more. import java.util.Scanner; public class easys { public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = in.nextInt(); int sum = 0; int curr = 0; double result = 0.0; for(int i=0;i<N;i++){ curr = in.nextInt(); sum = sum + curr;
} result = (double)sum/N; System.out.printf("%.6f",result); } } Re: easy[Java] public class HeatingMain1457_Accepted { public static void main(String[] args) { PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out)); Scanner x = new Scanner(System.in); short n = x.nextShort(); double s = 0; for (int i = 0; i < n; i++) { s += x.nextInt(); } writer.printf("%.6f", s / n); writer.close(); } } |
|
|