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
Which of the following BEST describes a permissive software license?
Olegator [25]

Answer:

B

Explanation:

A permissive software license is a free-software license which carries a minimal restrictions on how the software can be used, modified, and redistributed, usually including a warranty disclaimer.

I hope this helps.

Please rate me brainliest.

8 0
2 years ago
Your network employs basic authentication that centers on usernames and passwords. However, you have two ongoing problems. The f
Agata [3.3K]

Answer:

Using a one time password OTP and using a three factor authentication.

Explanation:

Social engineering is a form system and network attack, drafted by an attacker, to steal user credentials needed for accessing their accounts, to steal information.

Social engineering attacks like phishing, spear phishing, baiting and quid quo pro are used to fool users to giving out their user details.

One time password is an implied use of a password just once and a new password his generated to boost security. In a three factor authentication, OTP can be used as well as biometrics of a user which can not be giving away by a user to an attacker.

8 0
3 years ago
Which operating system became obsolete with the arrival of a more advanced graphical user interfaces
12345 [234]
The answer is Ms Dos
6 0
3 years ago
When parking ur vehicle facing downhill with a curb, you should point ur front wheels?
Genrish500 [490]
Wheels should be pointing towards the curb. this is in case your vehicle rolls, if it does, the wheel will hit the curb and stop the car, it will also prevent the car from going into the road and incoming traffic. vice versa when parking uphill, point wheels away from curb, that is also to prevent the car from rolling to incoming traffic.
6 0
3 years ago
Read 2 more answers
Describe the difference between the while loop and the do-while loop.
Karo-lina-s [1.5K]

Answer:

The difference between While loop and Do - While loop are explained below.

Explanation:

  • While loop : It is a looping procedure in which the statements inside the while loop are executed depending on the condition outside the while before starting the loop.
  • If the condition is true then the code inside loop is executed otherwise not.
  • Do - While loop:  It is a looping procedure in which the statements inside the loop get executed and then the condition at the end of the loop is checked.
  • This means even the condition is fails the statements inside the loop are executed once.
  • Do while loop name itself suggests that "do the while and then check the condition".  
7 0
3 years ago
Other questions:
  • How do i start makeing a Character in the Unreal Game Engine
    14·2 answers
  • Host A and B are directly connected with a 100 Mbps link. There is one TCP connection between the two hosts, and Host A is sendi
    14·1 answer
  • Credibility means that the reader perceives value in what you write.<br> True False
    12·1 answer
  • In the history of Social Media what are two points that stood out?
    12·1 answer
  • What are the advantages and disadvantages of fortran?
    13·1 answer
  • Lazarus Consulting is a large computer consulting company in New York. Pete Lazarus, theà CEOà and founder, is well known for hi
    8·1 answer
  • In your own words, describe how a network administrator can use the OSI model to isolate a network problem.
    13·1 answer
  • PLEASE ANSWER!! If my pixel has an RGB value of (R - 150, G - 0, B - 100), what is the dominant value? Why?
    14·1 answer
  • PLEASE HELP ITS CODING AND I INCLUDED A SCREENSHOT OF WHAT TO DO
    14·1 answer
  • I need help pls help me
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!