Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- int n;
- srand(time(NULL)); /// Initializare random
- int maxim=rand() % 50 + 1; /// Generez primul numar si presupun ca e maxim
- cout<<maxim<<' '; /// si-l afisez
- for(int i=1;i<10;++i) /// Repet generarea a altor 9 numere
- {
- n=rand() % 50 + 1; /// Generez alt numar
- cout<<n<<' '; /// si-l afisez
- if(n>maxim) /// Daca e mai mare, il retin
- maxim=n;
- }
- cout<<"\nMaximul este "<<maxim;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement