Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int x,y,z,a,b;
- int p = 5;
- int i;
- int sr = 0;
- int tymczasowa;
- int tab[p];
- bool zmienna = false;
- for ( i = 0 ; i < p ; i++)
- {
- cout << "Podaj liczbe: " << endl;
- cin >> x;
- tab[i] = x;
- sr = sr+x;
- }
- do
- {
- zmienna = false;
- for(i=0;i<p;i++)
- {
- if(tab[i+1] > tab[i])
- {
- tymczasowa = tab[i+1];
- tab[i+1] = tab[i];
- tab[i] = tymczasowa;
- zmienna = true;
- }
- }
- }while(zmienna == true);
- sr = sr/5;
- cout << "Wartosc najwieksza wynosi: " << tab[0] << endl;
- cout << "Wartosc najmniejsza wynosi: " << tab[p-1] << endl;
- cout << "Wartosc srednia wynosi: " << sr<< endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement