Q:

Write a C++ program to check whether two given integer values are in the range 20..50 inclusive. Return true if 1 or other is in the said range otherwise false

0

Write a C++ program to check whether two given integer values are in the range 20..50 inclusive. Return true if 1 or other is in the said range otherwise false

Sample Output:

1
1
1
0

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>

using namespace std;

bool test(int x, int y)
        {
            return (x <= 20 || y >= 50) || (y <= 20 || x >= 50);
        }
        
int main() 
 {
  cout << test(20, 84) << endl;  
  cout << test(14, 50) << endl;  
  cout << test(11, 45) << endl;  
  cout << test(25, 40) << endl;    
  return 0;    
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now