1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Katyanochek1 [597]
3 years ago
12

1 #include 2 3 int max2(int x, int y) { 4 int result = y; 5 if (x > y) { 6 result = x; 7 } 8 return result; 9 } 10 11 int max

3(int x, int y, int z) { 12 return max2(max2(x,y),z); 13 } 14 15 int main() { 16 int a = 5, b = 7, c = 3; 17 18 printf("%d\n",max3(a, b, c)); 19 20 printf("\n\n"); 21 return 0; 22 } What number is printed when the program is run?
Computers and Technology
1 answer:
Serhud [2]3 years ago
6 0

Answer:

7

Explanation:

#include <stdio.h>

int max2(int x, int y) {

   int result = y;

   if (x > y) {

       result = x;

   }

   return result;

}

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

   return max2(max2(x,y),z);

}

int main() {

   int a = 5, b = 7, c = 3;

   printf("%d",max3(a, b, c));

   printf("");

   return 0;

}

Hi, first of all, next time you post the question, it would be nice to copy and paste like above. This will help us to read the code easily. Thanks for your cooperation.

We start from the main function:

The variables are initialized → a = 5, b = 7, c = 3

max3 function is called with previous variables and the result is printed → printf("%d",max3(a, b, c));

We go to the max3 function:

It takes 3 integers as parameters and returns the result of → max2(max2(x,y),z)

Note that max2 function is called two times here (One call is in another call actually. That is why we need to first evaluate the inner one and use the result of that as first parameter for the outer call)

We go to the max2 function:

It takes 2 integers as parameters. If the first one is greater than the second one, it returns first one. Otherwise, it returns the second one.

First we deal with the inner call. max2(x,y) is max2(5,7) and the it returns 7.

Now, we need to take care the outer call max2(7, z) is max2(7, 3) and it returns 7 again.

Thus, the program prints 7.

You might be interested in
Which of the following is the most effective password?
zzz [600]
I would have to say that the M3(ury would be the MOST effective, because it has more capitals, numbers, and symbols, which would make it harder to hack into.
5 0
3 years ago
Read 2 more answers
Use the drop-down menus to match each description to the correct term.
maw [93]

Answer:

unknown

Explanation:

the location of each drop-down menu is not given and the answer choices are not shown as well, if they are it is hard to see, try reposting the question with maybe a bracket set ' [ ] ' to represent the blanks, then below you can number the answers available, such as this

President [ ] was in office during the civil war, after the [ ] won the war, he united the states once again

1st BLANK

Abraham Lincoln

John Adams

George Bush

2nd BLANK

Union

Confederates

British

(i just made up this question, its not any part of any test questions)

i hope this helps you out a lil bit :)

4 0
3 years ago
Read 2 more answers
Peter is a data analyst in a financial firm. He maintains a spreadsheet that contains all employee details. Peter wants to analy
alukav5142 [94]

Answer: filter the data of employees with more than five years of experience

Explanation:

The technique that Peter can use to perform this analysis is to filter the data of employees with more than five years of experience.

Filter in spreadsheets allows one to see the data that is required based on the input that was given. In this case, since Peter wants to analyze the data of all employees that have experience of more than five years, this can be filtered and the employees who have experience of more than 5 years will be shown.

The workers who have experience of less than five years will not b shown in this case.

3 0
3 years ago
Characteristics of a deterministic system<br>​
Fiesta28 [93]

Explanation:

deterministic system is a involved in development of future states of the system is called deterministic determinstic system.

3 0
3 years ago
Q9. Complete the table with the name of the functions
umka21 [38]

Answer:

1. VLOOKUP function.

2. SUMIF function.

3. COUNT function.

4. IF function.

5. HLOOKUP function.

Explanation:

Microsoft Excel is a software application or program designed and developed by Microsoft Inc., for analyzing and visualizing spreadsheet documents. There are different types of functions used in Microsoft Excel to perform specific tasks and these includes;

1. VLOOKUP function: it's an Excel function that avails end users the ability to lookup data in a table organized vertically. Thus, it's typically used for searching values in a column.

2. SUMIF function: it is an Excel function to sum cells that meet criteria such as text, dates and numbers. This function can be used with the following logical operators; <, >, and =.

3. COUNT function: it's an Excel function to find the total number of entries in a column. For example, to count the number of entries in B1:B15; COUNT(B2:B15).

4. IF function: runs a logical test and returns one value for a TRUE result, and another for a FALSE result. For example, to fail scores that are below 40; IF (A1 < 40, "Fail", "Pass").

5. HLOOKUP function: it's an Excel function that avails end users the ability to lookup data in a table organized horizontally. Thus, it's typically used for searching values in a column.

4 0
3 years ago
Other questions:
  • In what country did true printing first take place?
    12·2 answers
  • Using the college registration example from section 6.7.3 as a starting point, do the following:
    14·1 answer
  • g Write a program that prompts the user for an integer n between 1 and 100. If the number is outside the range, it prints an err
    5·1 answer
  • In the Stop-and-Wait flow-control protocol, what best describes the sender’s (S) and receiver’s (R) respective window sizes?
    14·1 answer
  • PLEASE HELP I'M TAKING A QUIZ AND I HAVE 5 MINUTES LEFT
    13·2 answers
  • Two Technicians are discussing ShopKey Pro. Technician
    14·1 answer
  • Yuki is preparing to write a research paper for his history class. Which style guide would be best for him to use?
    8·2 answers
  • What is one effective way for employees to keep their skillsets current?
    8·2 answers
  • How do assignment article computer security, ethics and privacy?
    15·1 answer
  • _____ is rampant with bugs and shortcomings because most programmers do not know how or do not take the time to incorporate secu
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!