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 compute the sum of the two given integers. If one of the given integer value is in the range 10..20 inclusive return 18
Q:

Write a C++ program to compute the sum of the two given integers. If one of the given integer value is in the range 10..20 inclusive return 18

0

Write a C++ program to compute the sum of the two given integers. If one of the given integer value is in the range 10..20 inclusive return 18

Sample Output:

10
18
18
241

All Answers

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

#include <iostream>

using namespace std;

int test(int x, int y)
        {
            return (x >= 10 && x <= 20) || (y >= 10 && y <= 20) ? 18 : x + y;
        }
     
        
int main() 
 {
  cout << test(3, 7) << endl; 
  cout << test(10, 11) << endl; 
  cout << test(10, 20) << endl;
  cout << test(21, 220) << 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