answersLogoWhite

0

double mean(int list[], int arraySize)

{

double result=0;

for(int i=0; i<arraySize; ++i )

result += list[i];

return(result/size);

}

User Avatar

Wiki User

11y ago

What else can I help you with?

Continue Learning about Engineering

Write the prototype of a function' divide' that takes two integer values and returns the quotient of double type.?

Your question isn't a question, but here is the answer: double divide (int p, int q);


When function returns a value the entire function call can be assigned a variable?

AnswerYes, it can. For instance, if your function returns double you can assign the function call to a variable of type double.AnswerNo, only the returned value, of course.


How would you write a function prototype for a function named calcAreaReact that accepts two arguments width and length and returns the area.?

double calcAreaRect (double a, double b);


How do you find the square root of a number in C?

You write a function that evaluates the square root of its argument and returns the result to the caller.You can also use the run-time library functions in math.h ...double sqrt (double x);double pow (double x, (double) 0.5);


How do you use pow function in c?

Either you can use the pre defined function "pow" in the &lt;math.h&gt; header file OR you can make a user defined function to do the same operation. 1.Using the pre defined function in &lt;math.h&gt; : The function is a of datatype double and accepts only values in double. So, prototype declaration is: double pow(double x,double y); Pass the values to the function and it'll return the value of xy. In the calling function it can be declared as: double power=pow(x,y); 2.USER DEFINED FUNCTION: double power(double x,int y); int main() { double x,result; int y; cout&lt;&lt;"\nEnter the base: "&lt;&lt;; cin&gt;&gt;x; cout&lt;&lt;"\nEnter the exponential power: "; cin&gt;&gt;y; result=power(x,y); cout&lt;&lt;"The result of x to the power y is: "&lt;&lt;result; return 0; } double power(double x,int y) { for(int i=0;i&lt;=y;i++) { x*=x; } return x; }

Related Questions

Find out the smallest and biggest element in an 1-d array?

#include using std::cin;using std::cout;using std::endl;double minimum(double myArray[], const intarraySize);double maximum(double myArray[], const intarraySize);int main(){const int arraySize = 10;double myArray[arraySize] = {0.0};cout


Write the prototype of a function' divide' that takes two integer values and returns the quotient of double type.?

Your question isn't a question, but here is the answer: double divide (int p, int q);


When function returns a value the entire function call can be assigned a variable?

AnswerYes, it can. For instance, if your function returns double you can assign the function call to a variable of type double.AnswerNo, only the returned value, of course.


How would you write a function prototype for a function named calcAreaReact that accepts two arguments width and length and returns the area.?

double calcAreaRect (double a, double b);


To input an integer array and print the first two maximum numbers?

Here is an example for type double:#include using std::cin;using std::cout;using std::endl;double maxFirst(const double data[], int index);double maxSecond(const double data[], int index, double maxNumber1);double sum(double max1, double max2);int main(){const int arraySize = 10;double myArray[arraySize] ={0.0};cout


Explain use of pow in c language?

The general form of the pow function is: double pow(double base, double exp); Which returns the value of baseexp This function may be overloaded to allow for different parameter and return types, but the basic function is the same.


Write a c plus plus program to print the average of the two largest element of an array?

#include using std::cin;using std::cout;using std::endl;double maxFirst(const double data[], intindex);double maxSecond(const double data[], intindex, double maxNumber1);double sum(double max1, double max2);int main(){double myArray[] = {1.0,4.6,32.1,9.7,41.2,41.3,343,23,566.02,345.8,675.5,654.4};int arraySize = (sizeof myArray)/(sizeof myArray[0]);cout


How do you find the square root of a number in C?

You write a function that evaluates the square root of its argument and returns the result to the caller.You can also use the run-time library functions in math.h ...double sqrt (double x);double pow (double x, (double) 0.5);


What is C program to find power of number?

Use #include &lt;math.h&gt;, and then add to your code the function pow(x, y), which returns double and equals to x to power y (x and are both double).


How can I calculate a double integral using the trapz function in MATLAB?

To calculate a double integral using the trapz function in MATLAB, you can first create a grid of points for the two variables you are integrating over. Then, evaluate the function you are integrating at these points to create a matrix of function values. Finally, use the trapz function twice - once along one dimension and then along the other dimension - to compute the double integral.


How do you use pow function in c?

Either you can use the pre defined function "pow" in the &lt;math.h&gt; header file OR you can make a user defined function to do the same operation. 1.Using the pre defined function in &lt;math.h&gt; : The function is a of datatype double and accepts only values in double. So, prototype declaration is: double pow(double x,double y); Pass the values to the function and it'll return the value of xy. In the calling function it can be declared as: double power=pow(x,y); 2.USER DEFINED FUNCTION: double power(double x,int y); int main() { double x,result; int y; cout&lt;&lt;"\nEnter the base: "&lt;&lt;; cin&gt;&gt;x; cout&lt;&lt;"\nEnter the exponential power: "; cin&gt;&gt;y; result=power(x,y); cout&lt;&lt;"The result of x to the power y is: "&lt;&lt;result; return 0; } double power(double x,int y) { for(int i=0;i&lt;=y;i++) { x*=x; } return x; }


how to write a function that takes one argument F for Fahrenheit and returns the result in Celsius c the formula for the conversion is c plus F-3259?

double celsius (double fahrenheit) { return (fahrenheit - 32.) * 5. / 9.; }