Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int x,y,z;
- cout << "Podaj pierwszy kraniec przedzialu" << endl;
- cin >> x;
- cout << "Podaj drugi kraniec przedzialu" << endl;
- cin >> y;
- cout << "Podaj liczbe jaka chcesz sprawdzic" << endl;
- cin >> z;
- if ( x < y)
- {
- if ( z >= x && z <= y)
- {
- cout << "Liczba znajduje sie w przedziale" << endl;
- }
- else
- {
- cout << "Liczba nie znajduje sie w przedziale" << endl;
- }
- }
- else
- {
- if ( z >= y && z <= x)
- {
- cout << "Liczba znajduje sie w przedziale" << endl;
- }
- else
- {
- cout << "Liczba nie znajduje sie w przedziale" << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement