Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- float a,b,c,d,e,sr,mx,mn; //sr - srednia; mx - wartosc max; mn - wartosc min
- cout << "Podaj 5 liczb oddzielonych spacja albo enterem:" << endl;
- cin >>a>>b>>c>>d>>e;
- sr=(a+b+c+d+e)/5;
- mx=a;
- if (b>mx)
- {
- mx=b;
- }
- if (c>mx)
- {
- mx=c;
- }
- if (d>mx)
- {
- mx=d;
- }
- if (e>mx)
- {
- mx=e;
- }
- mn=a;
- if (mn>b)
- {
- mn=b;
- }
- if (mn>c)
- {
- mn=c;
- }
- if (mn>d)
- {
- mn=d;
- }
- if (mn>e)
- {
- mn=e;
- }
- cout << "Najwieksza liczba to: " << mx << endl;
- cout << "Najmniejsza liczba to: " << mn << endl;
- cout << "Srednia z podanych liczb wynosi: " << sr << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement