Created
October 20, 2016 18:51
-
-
Save anonymous/a0c95e1a5418099624e6edc12f0658ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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