JakubKaczmarek_123

zadanie 15

Nov 13th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. float x[5], n;
  5.  
  6. int main()
  7. {
  8.  for (int i = 0; i < 5; i++){
  9.     cout << "wprowadz " << i+1 << " liczbe: " << endl;
  10.     cin >>x[i];
  11.  }
  12.  n = x[0];
  13.  for (int i = 1; i < 5; i++) if (n < x[i]) n = x[i];
  14.  cout << "najwieksza liczba to: " << n << endl;
  15.  n = x[0];
  16.  for (int i = 1; i < 5; i++) if (n > x[i]) n = x[i];
  17.  cout << "najmniejsza liczba to: " << n << endl;
  18.  n = 0;
  19.  for (int i = 0; i < 5; i++) n += x[i];
  20.  
  21.  cout << "srednia to: " << n/5 << endl;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment