Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int b,min,max;
- cout << "Podaj ilosc liczb: ";
- cin >> b;
- int a[b];
- for(int i = 0; i<b; i++)
- {
- cout << "Podaj liczbe numer " << i+1 << ": ";
- cin >> a[i];
- }
- min = a[0];
- max = a[0];
- for(int i = 0; i < b; i++)
- {
- min = a[0];
- if(a[i] < min)
- {
- min = a[i];
- }
- if(a[i] > max)
- {
- max = a[i];
- }
- }
- cout << min << endl;
- cout << max;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement