Advertisement
Guest User

max

a guest
Nov 28th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<cstdio>
  4. #include<ctime>
  5. using namespace std;
  6. int main()
  7. {
  8. int dane[10];
  9. srand(time(NULL));
  10. for(int i=0;i<10;i++)
  11.         {dane[i]=5+rand()%46;
  12.         cout<<dane[i]<<",";
  13. }
  14. cout<<endl;
  15. int max;
  16. max=dane[0];
  17. for(int i=1;i<10;i++)
  18. {if (dane[i]>max)
  19.     {
  20.           max=dane[i];                
  21.      }        
  22. }
  23.           cout<<"Najwieksza liczba to: "<<max<<endl;
  24.  
  25. system("PAUSE");
  26. return EXIT_SUCCESS;    
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement