A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a C++ program to check three given integers and return true if one of them is 20 or more less than one of the others
Q:

Write a C++ program to check three given integers and return true if one of them is 20 or more less than one of the others

0

Write a C++ program to check three given integers and return true if one of them is 20 or more less than one of the others

Sample Output:

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, int z)
        {
          return abs(x - y) >= 20 || abs(x - z) >= 20 ||
                   abs(y - z) >= 20;
        }
        
        
int main() 
 {
  cout << test(11, 21, 31) << endl;  
  cout << test(11, 22, 31) << endl;  
  cout << test(10, 20, 15) << 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