Advertisement
pan7nikt

Najmniejsza_Liczba

Jan 28th, 2020
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. int tab[30];
  7. int i;
  8. int m;
  9.  
  10. main()
  11. {
  12.     srand(time(NULL));
  13.    
  14.     for(i=0;i<30;i++)
  15.     {
  16.         tab[i] = rand()%201 - 100;
  17.         cout << tab[i] << ". " << endl;
  18.     }
  19.    
  20.     for (i=0;i<30;i++)
  21.     {
  22.         if (m > tab[i])
  23.         {
  24.             m = tab[i];
  25.         }
  26.     }
  27.    
  28.     cout << "Najmniejsza liczba z tego zbioru to " << m << endl;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement