Q:

Write a C++ program to check two given integers whether either of them is in the range 100..200 inclusive

0

Write a C++ program to check two given integers whether either of them is in the range 100..200 inclusive

Sample Output:

1
0
1

 

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 >= 100 && x <= 200) || (y >= 100 && y <= 200);
        }
        
int main() 
 {
  cout << test(100, 199) << endl;  
  cout << test(250, 300) << endl;  
  cout << test(105, 190) << 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