Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- System.out.print("Введите размер списка: ");
- int ss = s.nextInt();
- int[] l = new int[ss];
- for (int i = 0; i < l.length; i++) {
- System.out.print("Цена " + (i + 1) + " продукта: ");
- l[i] = s.nextInt();
- }
- int sum = 0;
- for (int aL : l) {
- sum += aL;
- }
- System.out.println("Сумма: " + sum);
- System.out.println("Средняя цена: " + (sum / l.length));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement