/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

BOSING, CHECK MO DITO YUNG CODE KUNG PASADO SA'YO PARA MAS MADALING INTINDIHIN. SALAMAT.
DI SA'KIN 'TO. INEDIT KO LANG NG KAUNTI.
https://www.onlinegdb.com/online_c++_compiler#
*******************************************************************************/

#include <iostream>

void printStatistics(int n);


void printStatistics(int n)
{
    int response;
    int sum = 0;
    int max;
    int min;

    for (int i = 1; i <= n; ++i)
    {
        std::cout << "Please enter the number in the " << i << " position: ";
        std::cin >> response;
        if (i == 1)
        {
            min = response;
            max = response;
        }
        (min > response) ? min = response : min = min;
        (max < response) ? max = response : max = max;
        sum += response;
    }
    std::cout << "RESULTS: "<< std::endl;
    std::cout << "Sum: " << sum << std::endl;
    std::cout << "Average: " << (float)sum / n << std::endl;
    std::cout << "Smallest: " << min << std::endl;
    std::cout << "Largest: " << max << std::endl;
}


int main()
{
    int numberCount;
    do
    {
        std::cout << "How many number of elements would you like to process? ";
        std::cin >> numberCount;
    }while(numberCount <= 0);
    printStatistics(numberCount);   
}
