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]
2 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]2 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
When do you use an else statement?
gizmo_the_mogwai [7]

Answer: In JavaScript we have the following conditional statements: Use if to specify a block of code to be executed, if a specified condition is true. Use else to specify a block of code to be executed, if the same condition is false. Use else if to specify a new condition to test, if the first condition is false.

Explanation:

6 0
3 years ago
Explain the concept of conditional formatting​
tamaranim1 [39]

Answer:

conditional formatting is a feature in many spreadsheet application that allow you to apply specific formatting to cells that meet certain criteria.It is most often used on color based formatting to highlight emphasize or differentiate among data and information stored in spreadsheet

8 0
2 years ago
Select the focus questions that emphasizes what is more important: (Select all that apply) a.What needs to be relegated to the b
agasfer [191]

Answer:

Options b and d

Explanation:

Option B: What needs to be bigger and more prominent?

This gets the more foucs on the first look of the product to the user. Let's say you are developing a website and in the first page, your name and logo must be prominent and bigger than the rest of the elements on that webpage makes the user remember your name and the business model which gets more focus.

Option D: What needs to be brought into view in the foreground?

As the index says, face is the index of the mind, your product's index page is the face of your product. Hence it should be prioritized to show what is important and what is not.

The above two questions are the most important questions to be considered while emphasizing on what is more important.

5 0
3 years ago
Dose anyone know how to change username, grade level, and gender here? I have tried it in the change preferences and it says it
alukav5142 [94]

Answer:no I don’t, sorry

Explanation:

6 0
3 years ago
Read 2 more answers
Possible consequences for plagiarism, listed in CAVA's Academic Integrity Policy, may include:
Ahat [919]

CAVA’s Academic Integrity Policy refers to Calfornia Virtual Academic’s policy book for students of their schools, which are public charter schools in the state of California.

In the handbook, it is mentioned that students who commit plagiarism will be required to re-submit the assignment during the first offence; will receive a fail grade for the assignment during the second offence; and will be withdrawn from a course or even the school during the third offence.

Thus the answer to the question is (D) all of the above.

8 0
3 years ago
Other questions:
  • How can i add card reader to pc answers?
    9·1 answer
  • How long does it take a letter to arrive?
    9·1 answer
  • Write a class called Counter that represents a simple tally counter, which might be used to count people as they enter a room. T
    9·1 answer
  • Original Problem statement from the Text: A retail company must file a monthly sales tax report listing the sales for the month
    7·1 answer
  • What is the quickest way to change the format of a table?
    8·1 answer
  • Write an algorithm that gets as input your current credit card balance, the total dollar amount of new purchases, and the total
    8·1 answer
  • Write a program that allows the user to enter a time in seconds and then outputs how far an object would drop if it is in free f
    7·1 answer
  • D) Informal high level descuption of an algorithm in english kcalled
    9·2 answers
  • Which online article citation is correctly formatted according to MLA standards?
    15·2 answers
  • Using existing algorithms as building blocks for new algorithms has all the following benefits EXCEPT
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!