Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. using namespace std;
  2. int main()
  3. {
  4.  
  5.     const int Size = 50;
  6.     int UserSizeArray = 0;
  7.     double Sum = 0;
  8.     double Result = 0;
  9.     int NumberToDevide = 0;
  10.     int Less = 0, Greater = 0;
  11.     cout << "Enter the size of the array :" << endl;
  12.     cin >> UserSizeArray;
  13.     int MyArray[Size];
  14.     cout << "Enter how many elements of the array :" << endl;
  15.     for (int i = 0; i < UserSizeArray; i++)
  16.     {
  17.         cin >> MyArray[i];
  18.         NumberToDevide++;
  19.     }
  20.     for (int i = 0; i < UserSizeArray; i++)
  21.     {
  22.         Sum = Sum + MyArray[i];
  23.     }
  24.     Result = (Sum / NumberToDevide); // The Answer of The sum Array
  25.     for (int i = 0; i < UserSizeArray; i++)
  26.     {
  27.         if (MyArray[i] < Result)
  28.         {
  29.             Less++;
  30.         }
  31.         else
  32.         {
  33.             Greater++;
  34.         }
  35.     }
  36.     cout << "The Avarage Sum of the array is : " << Result << endl;
  37.     cout << "The numbers of values less than : " << Result << " Is : " << Less << endl;
  38.     cout << "The numbers of values greater than : " << Result << " Is : " << Greater << endl;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement