Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int suma = 0;
- int max;
- int min;
- double srednia = 0;
- int ilosc_liczb = 0;
- int liczba = 0;
- cout << "Ile liczb chcesz wprowadzic?" << endl;
- cin >> ilosc_liczb;
- for( int i = 0; i < ilosc_liczb; i++ )
- {
- min = liczba;
- max = liczba;
- cin >> liczba;
- suma += liczba;
- if( liczba < min )
- {
- min = liczba;
- }
- else if( liczba > max )
- {
- max = liczba;
- }
- }
- srednia = suma / ilosc_liczb;
- cout << "Najmniejsza liczba wynosi: " << min << endl;
- cout << "Najwieksza liczba wynosi: " << max << endl;
- cout << "Srednia arytmetyczna podanych liczb wynosi: " << srednia << endl;
- system( "PAUSE" );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement