Advertisement
Regeneric

Untitled

Mar 8th, 2021
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. static int a, b, c, d, e;
  6.  
  7. int najm();
  8. int najw();
  9.  
  10. int main() {
  11.     std::setlocale(LC_ALL, "pl_PL.UTF-8");
  12.  
  13.     cout << "Podaj liczby: ";
  14.     cin >> a >> b >> c >> d >> e;
  15.  
  16.     cout << "Najmniejsza wartość: "<< najm() << endl;
  17.     cout << "Największa wartość: " << najw() << endl;
  18.  
  19.   return 0;
  20. }
  21.  
  22.  
  23. int najm() {
  24.     int m = a;
  25.     if(b < m) m = b;
  26.     if(c < m) m = c;
  27.     if(d < m) m = d;
  28.     if(e < m) m = e;
  29.    
  30.     return m;
  31. }
  32.  
  33. int najw() {
  34.     int m = a ;
  35.     if(b > m) m = b;
  36.     if(c > m) m = c;
  37.     if(d > m) m = d;
  38.     if(e > m) m = e;
  39.  
  40.     return m;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement