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
What can be done in order to secure a WLAN/wireless access point?
polet [3.4K]

Answer:

this may help "Change default passwords. ...

Restrict access. ...

Encrypt the data on your network. ...

Protect your Service Set Identifier (SSID). ...

Install a firewall. ...

Maintain antivirus software. ...

Use file sharing with caution. ...

Keep your access point software patched and up to date."

Explanation:

4 0
3 years ago
Write a function, AvgList, that takes a single argument, a list, and returns the average (mean) of the numbers in the list. You
8_murik_8 [283]

Answer:

Answered below

Explanation:

//Programmed in Java

public double avgList(int [] nums){

int I;

double sumOfNumbers = 0;

double averageOfNumbers = 0;

//Loop over to sum all elements in the list.

for(I = 0; I < nums.length; I++){

sumOfNumbers += nums[I];

}

//Calculate the average

averageOfNumbers = sumOfNumbers/ nums.length;

return averageOfNumbers;

}

3 0
3 years ago
Which of the following is a technology designed for use in manufacturing?
Alenkasestr [34]

Answer:

B) machine-to-machine (M2M) communications

Explanation:

Manufacturing technology refers to the technological advancement that enables the production of the tools that further helps in the manufacturing of the other goods. The quality, quantity, and production are enhanced with these manufacturing technologies. Machine-to-machine communications are designed for manufacturing technologies. In this technology, the information and data can be easily transferred from one device to another either by the help of wires or without wires.

4 0
4 years ago
You should reach across something to lift a load is this true or false
Grace [21]

Answer:

False. Never reach across a load when you're trying to lift it.

3 0
3 years ago
The __________ contains the basic elements of a user's program and can be generated directly from a compiled object file
icang [17]

Answer:

costumes

Explanation:

it will make a good impression and will make sure to get the same thing as you can see

3 0
2 years ago
Other questions:
  • The key requirement in selection of the facilitator is one who is the end-user.
    8·1 answer
  • In the INSERT statement that follows, assume that all of the table and column names are spelled correctly, that none of the colu
    9·1 answer
  • What is the simplest way to permanently get rid of an unwanted file? A. Go to the Start menu and then delete the file. B. Erase
    5·1 answer
  • A standard science experiment is to drop a ball and see how high it bounces. Once the bounciness of the ball has been determined
    10·1 answer
  • In order to create a multi-line comment, what symbol do you use?
    14·1 answer
  • Write a program that reads from a file called dictionary.txt which contains pairs of English and translated words separated by a
    12·1 answer
  • Knowledge management software helps companies preserve the knowledge gained through the use of information so that future users
    15·2 answers
  • Wiliam would like to sort a list of items after the data is already entered
    7·2 answers
  • A diminished triad can be indicated by
    5·1 answer
  • Which option is designed by software engineers?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!