Answer:
The following code as follows:
Code:
max=name1; //define variable max that holds name1 variable value.
if (strcmp(name2, max)>0) //if block.
{
max=name2; //assign value to max.
}
if (strcmp(name3,max)>0) //if block.
{
max=name3; //assign value to max.
}
Explanation:
In the above code, we define a variable that is max. The data type of max variable is the same as variables "name1, name2, and name3" that is "char". In the max variable, we assign the value of the name1 variable and use if block statement two times. In if block, we use strcmp() function that can be defined as:
- In first if block we pass two variables in strcmp() function that is "name2 and max" that compare string value. If the name2 variable is greater then max variable value so, the max variable value is change by name2 variable that is "max=name2".
- In second if block we pass two variables in strcmp() function that is "name3 and max" that compare string value. If the name3 variable is greater then max variable value so, the max variable value is change by name3 variable that is "max=name3".
Obviously, it is a laptop. So-Dimms are about half as long as Dimms, and are meant for laptops.
Answer:
import numpy as np
def sample_median(n, P):
return np.median( np.random.choice ( np.arange (1, len(P) + 1 ), n, p = P ) )
print(sample_median(10,[0.1 0.2 0.1 0.3 0.1 0.2]))
print(sample_median(10,[0.1 0.2 0.1 0.3 0.1 0.2]))
print(sample_median(5, [0.3,0.7])
print(sample_median(5, [0.3,0.7])
Explanation:
- Bring in the numpy library to use the median function provided by the numpy library.
- Define the sample_median function that takes in 2 parameters and returns the median with the help of built-in random, choice and arrange functions.
- Call the sample_median function by providing some values to test and then display the results.
Output:
4.5
4.0
2.0
1.0
the following C++ function will return true if the given non - negative number is multiple of 5 or 3 else it will return false.
bool function( int x ){
// variable to check if it is multiple of both or not
int number =0;
if(3%x == 0){
number++;
}
if(5%x == 0){
number++;
}
// Now returning by deciding
if( number <=1)
return true;
else
return false
}
The answer to your question is true