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
On a wireless router, what gives out IP addresses?<br> DHCP<br> DNS<br> WPA<br> WPS
attashe74 [19]

Answer:

DHCP

Explanation:

The only option can give IP addresses is the DHCP The Dynamic Host Configuration Protocol, because the DNS (Domain Name System) only translates IP addresses to a hostname, and WPS (Wi-Fi Protected Setup) or WPA (Wi-Fi Protected Access) if for security network, doesn't matter if is a wireless router, in a network always DHCP gives the IP addresses.

7 0
2 years ago
Assign decoded_tweet with user_tweet, replacing any occurrence of 'TTYL' with 'talk to you later'. Sample output with input: 'Go
nekit [7.7K]

Answer:

I am going to use the Python programming language to answer this. The source code is given below:

print("Enter your tweet here")

user_tweet = input()

decoded_tweet = user_tweet.replace('TTYL', 'talk to you later')

print("This is the decoded tweet: ")

print(decoded_tweet)

Explanation:

In the program the replace() module was used to replace 'TTYL' with 'talk to you later.'

Attached is the screenshot of the output.

8 0
3 years ago
Read 2 more answers
Which query will give the following result when it it applied on table 1????!!!!!
Mandarinka [93]

Answer:

B

Explanation:

You need Name , Age and Gender

the second requirement should only match the last row where age is 20 and gender is male.

thrid requirement of the query is that its syntax should be correct.

Option B staisfies all of required so it is the correct option.

6 0
3 years ago
_____ is the operation of setting a variable to a value.
Helen [10]

Answer:

Assignment is the operation of a variable to a value

3 0
3 years ago
Which of these items will least likely increase pressure in the evaporative emission control system?
ella [17]

Answer:

a

Explanation:

a

7 0
3 years ago
Other questions:
  • Constructors ________. initialize instance variables when overloaded, can have identical argument lists when overloaded, are sel
    11·1 answer
  • Design a module named getNumber, which uses a reference parameter variable to accept an Integer argument. The module should prom
    6·1 answer
  • If you wanted to create a graph that showed how much each value contributed to the whole value, you would use a _____.
    15·2 answers
  • The United States is the only country in the world in which organs and tissue transplants are performed. True or False?
    8·1 answer
  • I will upvote....
    10·1 answer
  • ​Client/server computing is​ a: A. network that connects sensors to desktop computers. B. distributed computing model where clie
    12·1 answer
  • Imma say something random...
    13·2 answers
  • In design and implementation of any _____ reasoning application, there are 4 Rs involved: retrieve, reuse, revise, and retain.
    7·1 answer
  • Rectangle perimeter is 72 .Find the new perimeter if length is doubled and breadth is tripled​
    7·1 answer
  • Edit the program provided so that it receives a series of numbers from the user and allows the user to press the enter key to in
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!