Skip to content

Instantly share code, notes, and snippets.

Created October 20, 2016 18:51
Show Gist options
  • Save anonymous/a0c95e1a5418099624e6edc12f0658ad to your computer and use it in GitHub Desktop.
Save anonymous/a0c95e1a5418099624e6edc12f0658ad to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;
int main()
{
srand( time( NULL ) );
// od 0 do 99
int tab[20];
int min=tab[0];
int max=tab[0];
for(int i=0;i<20;i++)
{
tab[i]=rand() % 100;
cout << tab[i] << ",";
}
for (int i=0;i<20;i++)
{
if(min>tab[i])
{
min = tab[i];
}
}
for (int j=0;j<20;j++)
{
if(max<tab[j])
{
max = tab[j];
}
}
cout << "najwieksza liczba jest " << max << endl;
cout << "najmniejsza liczba jest " << min << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment