Advertisement
Kacper_Michalak

Seria 2 Zadanie 19

Nov 16th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.   int x,y,z;
  8.  
  9.   cout << "Podaj pierwszy kraniec przedzialu" << endl;
  10.   cin >> x;
  11.   cout << "Podaj drugi kraniec przedzialu" << endl;
  12.   cin >> y;
  13.   cout << "Podaj liczbe jaka chcesz sprawdzic" << endl;
  14.   cin >> z;
  15.  
  16.   if ( x < y)
  17.   {
  18.     if ( z >= x && z <= y)
  19.     {
  20.       cout << "Liczba znajduje sie w przedziale" << endl;
  21.     }
  22.     else
  23.     {
  24.       cout << "Liczba nie znajduje sie w przedziale" << endl;
  25.     }
  26.   }
  27.   else
  28.   {
  29.       if ( z >= y && z <= x)
  30.     {
  31.       cout << "Liczba znajduje sie w przedziale" << endl;
  32.     }
  33.     else
  34.     {
  35.       cout << "Liczba nie znajduje sie w przedziale" << endl;
  36.     }
  37.   }
  38.     return 0;
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement