// Zadatak08.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <ctime>
using namespace std;
int main()
{
    //definiramo seed unutar for petlje
    //na taj način dobijemo 20 istih brojeva

    srand(time(0));
    int polje[20];
    float suma = 0;
    int umnozak = 1;

    for (int i = 0; i < 20; i++)
    {
        //rand() - vraća pseudo random cijele brojeva u intervalu od 0 do RAND_MAX
        polje[i] = rand() % 100; //brojevi od 0 do 99
        suma += polje[i];
        umnozak *= polje[i];
    }

    cout << "Ispis polja:";
    for (int i = 0; i < 20; i++)
        cout << polje[i] << " ";

    //najveći i najmanji broj u polju
    int najmanji = polje[0];
    int najveci = polje[0];

    for (int i = 1; i < 20; i++)
    {
        if (polje[i] > najveci)
            najveci = polje[i];
        if (polje[i] < najmanji)
            najmanji = polje[i];
    }

    cout << endl << "Najveci broj u polju je: " << najveci;
    cout << endl << "Najmanji broj u polju je: " << najmanji;
    cout << endl << "Suma elemanata polja je: " << suma;
    cout << endl << "Umnozak elemenata polja je: " << umnozak;
    cout << endl << "Aritmeticka sredina polja je: " << suma/20.0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
