Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <stdlib.h>
- using namespace std;
- int main()
- {
- srand(time(0));
- int polje[20];
- int min, max;
- for(int i = 0; i < 20; i++)
- {
- polje[i] = rand()%100 + 1;
- if(i == 0)
- {
- min = polje[i];
- max = polje[i];
- }
- else
- {
- if(polje[i] > max)
- {
- max = polje[i];
- }
- if(polje[i] < min)
- {
- min = polje[i];
- }
- }
- cout<<polje[i]<<" ";
- }
- cout<<endl;
- cout<<"Maksimalna vrednost: "<<max<<endl;
- cout<<"Minimalna vrednost: "<<min<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement