Answers
Here I am providing the answer for the above question:
Code:
#include <bits/stdc++.h>
using namespace std;
int midvalue(int , int , int ); //funtion declaration
int main()
{
cout <<"midvalue:"<<midvalue(5,28,14);
return 0;
}
int midvalue(int x, int y, int z)
{
//if y is greater than x and less then z (or) y is greater than z and less than x
if ((x < y && y < z) || (z < y && y < x))
return y;
//if x is greater than y and less then z (or) x is greater than z and less than y
else if ((y < x && x < z) || (z < x && x < y))
return x;
else
return z;
}
Screenshot of code:
Output:
Hoping that the above answer will help you...Thank you...