Callenge Activity 3.3.2: Function call in expression. Assign to maxSum the max o
ID: 3688903 • Letter: C
Question
Callenge Activity 3.3.2: Function call in expression. Assign to maxSum the max of (numA, numB) PLUS the max of (numY, numZ. Use just one statement. Hint: Call FindMax) twice in an expression. !!#include 3 double FindMax(double num1, double num2) t 4double maxVal -8.0; 5 6Note: if-else statements need not be understood to complete this activity 7if Cnum1 num2) t // if numl is greater than numz maxVal num1; // then numl is the maxVal. 10 else t // Otherwise, maxVal num2; I/ num2 is the maxVal. 12 13 return maxVal; 15 16 int main(void) [ 17 double numA 5.0; 18 double numB 10.0; 19 double numY 3.0: Run Foodback?Explanation / Answer
#include <stdio.h>
double FindMax(double num1, double num2)
{
double maxVal = 0.0;
if(num1 > num2)
maxVal = num1;
else
maxVal = num2;
return maxVal;
}
int main(void)
{
double numA = 5.0;
double numB = 10.0;
double numX = 3.0;
double numY = 7.0;
double maxSum = 0.0;
maxSum = ( FindMax(numA,numB) ) + ( FindMax(numX,numY) );
printf("maxSum is %.1f ",maxSum);
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.