Advertisement
Kacper_Michalak

Zadanie pętle 8

Dec 8th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int i;
  7.     int x;
  8.     int min;
  9.     int max;
  10.  
  11.     cout << "Podaj liczbe:" << endl;
  12.     cin >> x;
  13.     min = x;
  14.     max = x;
  15.  
  16.     while (x != 0)
  17.     {
  18.         if (min > x)
  19.             min = x;
  20.         if (max < x)
  21.             max = x;
  22.         cin >> x;
  23.     }
  24.     cout << "Wartosc maksymalna wynosi: "<< max << endl;
  25.     cout << "Wartosc minimalna wynosi: "<< min << endl;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement