Given the following function int strangeint x int y if x y

Given the following function: int strange(int x, int y) {if (x > y) return x + y; else return x - y;} what is the output of the following statement? cout

Solution

Program:

#include <iostream>
using namespace std;
int strange(int x, int y)
{
if(x>y)
return x+y;
else
return x-y;
}
int main()
{
cout<< strange(4,5) << endl;
return 0;
}

Output: - 1

Answer) Option a. -1

 Given the following function: int strange(int x, int y) {if (x > y) return x + y; else return x - y;} what is the output of the following statement? cout So

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site