Advertisement
knyazer

Untitled

Oct 15th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. package com.school;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner in = new Scanner(System.in);
  9.  
  10.         int arr[] = new int[10];
  11.         double average = 0;
  12.         int mult = 1;
  13.  
  14.         for (int i = 0; i < 10; i++) arr[i] = in.nextInt();
  15.  
  16.         Расчет среднего значения
  17.         for (int i = 0; i < 10; average += arr[i++]);
  18.         average *= 0.1;
  19.  
  20.         // Расчет произведения элементов меньше среднего
  21.         for (int i = 0; i < 10; i++)
  22.             if (arr[i] < average)
  23.                 mult *= arr[i];
  24.  
  25.         System.out.println(mult);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement