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
Alex73 [517]
3 years ago
6

Write the definition of a function max that has three int parameters and returns the largest.

Computers and Technology
2 answers:
dezoksy [38]3 years ago
7 0

Answer:

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

if(x > y && x > z)

return x;

else if(y > x && y > z)

return y;

else

return z;

}

Explanation:

I am going to write a c function for this.

The arguments are the values, and it is a int function because it returns an integer. So

The if clause is used to verify the largest value.

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

if(x > y && x > z)

return x;

else if(y > x && y > z)

return y;

else

return z;

}

g100num [7]3 years ago
4 0

Solution:

The definition of a function max that has three int parameters and returns the largest is given bellow:

def max(x,y,z):

if (x>z and x>y):

return (x)

elif (y>x and y>z):

return y

else:

return z

Thus this is required right answer.

You might be interested in
What is the device manager in windows 8?
astraxan [27]
This is the answer hope it helps :D

5 0
3 years ago
A contiguous subsequence of a list S is a subsequence made up of consecutive elements of S. For example, if S is 5,15,-30,10,-5,
Sindrei [870]

Answer:

We made use of the dynamic programming method to solve a linear-time algorithm which is given below in the explanation section.

Explanation:

Solution

(1) By making use of the  dynamic programming, we can solve the problem in linear time.

Now,

We consider a linear number of sub-problems, each of which can be solved using previously solved sub-problems in constant time, this giving a running time of O(n)

Let G[t] represent the sum of a maximum sum contiguous sub-sequence ending exactly at index t

Thus, given that:

G[t+1] = max{G[t] + A[t+1] ,A[t+1] } (for all   1<=t<= n-1)

Then,

G[0] = A[0].

Using the above recurrence relation, we can compute the sum of the optimal sub sequence for array A, which would just be the maximum over G[i] for 0 <= i<= n-1.

However, we are required to output the starting and ending indices of an optimal sub-sequence, we would use another array V where V[i] would store the starting index for a maximum sum contiguous sub sequence ending at index i.

Now the algorithm would be:

Create arrays G and V each of size n.

G[0] = A[0];

V[0] = 0;

max = G[0];

max_start = 0, max_end = 0;

For i going from 1 to n-1:

// We know that G[i] = max { G[i-1] + A[i], A[i] .

If ( G[i-1] > 0)

G[i] = G[i-1] + A[i];

V[i] = V[i-1];

Else

G[i] = A[i];

V[i] = i;

If ( G[i] > max)

max_start = V[i];

max_end = i;

max = G[i];

EndFor.

Output max_start and max_end.

The above algorithm takes O(n) time .

4 0
2 years ago
How is kerning used in Word?
kirill115 [55]

Answer: To adjust the spacing between characters that make up a word

Explanation: Kerning refers to the way spacing between two specific characters is adjusted. The idea is to give a better looking result by reducing the spacing between characters that fit together nicely (such as "A" and "V") and increasing the spacing between characters that don't. Select the text that you want to change.

4 0
2 years ago
What does the abbreviation gps mean?
MissTica
GPS stands for Global Positioning System
5 0
3 years ago
Read 2 more answers
This Command to insert copied text anywhere in your document
harina [27]

Answer:

Paste

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Jorge has $300 for work he performed. He expects to spend the money in the next few weeks to buy a new bike. Which type of accou
    8·1 answer
  • You should use html elements instead of server controls when
    11·1 answer
  • 1. Access and PowerPoint are not included in all configurations of Microsoft Office 2013.
    14·1 answer
  • Write a program that asks the user for three strings. Then, print out whether the first string concatenated to the second string
    8·1 answer
  • Why are you unable to modify the budget file, when you have the allow full control ntfs permission?
    5·1 answer
  • In an information systems framework, ________ is the bridge between the computer side on the left and the human side on the righ
    14·1 answer
  • My speaker on my phone is not working, when I try and play music and videos the sound dosen't work. However my alarm works. Can
    9·2 answers
  • Fill in the blanks : To store 3 character a computer occupies...................bytes memory space​
    8·2 answers
  • Write two example use of relationships ICT
    11·1 answer
  • Maria is conducting a security investigation and has identified a suspect. The suspect is an employee of the organization who ha
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!