c programming 1 Complete the function named max3 that accept

(c++ programming)

1.) Complete the function named max3 that accepts three passed integer parameters named x, y, & z and that returns the value that is the maximum value. You can assume that all 3 parameters are unique. Do not write a whole program. Do not write a call statement. Do not write a function declaration statement (i.e. function prototype).

int max3(int x, int y, int z)
{

Solution

#include<iostream>
using namespace std;

int max3(int x, int y, int z)
{
int max;
  
if(x>y)
max = x;
else
max = y;
  
if(z>max)
max = z;
  
return max;
}
int main(void) {
   // your code goes here
int x = 2,y = 5,z = 3;
  
cout << \"Maximum of the three numbers is : \" << max3(x,y,z);
   return 0;
}

OUTPUT:

Maximum of the three numbers is : 5

(c++ programming) 1.) Complete the function named max3 that accepts three passed integer parameters named x, y, & z and that returns the value that is the m

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site