Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4.     int b,min,max;
  5.     cout << "Podaj ilosc liczb: ";
  6.     cin >> b;
  7.     int a[b];
  8.     for(int i = 0; i<b; i++)
  9.     {
  10.         cout << "Podaj liczbe numer " << i+1 << ": ";
  11.         cin >> a[i];
  12.     }
  13.     min = a[0];
  14.     max = a[0];
  15.         for(int i = 0; i < b; i++)
  16.     {
  17.         min = a[0];
  18.         if(a[i] < min)
  19.         {
  20.             min = a[i];
  21.         }
  22.         if(a[i] > max)
  23.         {
  24.             max = a[i];
  25.         }
  26.     }
  27.     cout << min << endl;
  28.     cout << max;
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement