Calculate the geometric mean of numbers

Assignment Help MATLAB Programming
Reference no: EM13164600

Write a program to calculate the geometric mean of numbers entered by a user. The program should prompt the user to enter numbers and continue to accept the numbers until the user enters 999.

Note: Do not include 999 when calculating the average.

The geometric mean of a set of numbers (x1, x2, ... xn) is given by:

(X1 * X2 ...Xn)^ 1/n

For example, the geometric mean of 3, 5, 7 and 9:

(3*5*7*9)^ 1/4 = 5.5444

The flow of the program should be as follows:

  1. Prompt the user to enter a number
  2. User enters a number
  3. Process the number
  4. Program continues to prompt user to enter numbers (repeat steps 1-3) until user enters 999
  5. Program displays the message 'The geometric mean is ' and then prints the mean of all the entered numbers (excluding 999) to the screen

Reference no: EM13164600

Questions Cloud

Reads from the external file input.txt : Program that reads from the external file input.txt, counts the letters in every word, replaces the word by that number, and then writes the numbers to an external file output.tx
Design a program that extends the definition of the class : Design a program that extends the definition of the class JFrame to display a window on the screen. Name your class PropertyTax1, title your window "Calculation of Property Taxes," set the window's width to 400 pixels and height to 300 pixels, and te..
Program to keep track of the participants in a triathlon : Create a program to keep track of the participants in a triathlon. Your program will keep track of the times in three events: Running, Swimming, and Biking. Your program will calculate who is the winner in the Male category and the Female category..
Write an abstract class carbon footprint : Using an abstract class with only pure virtual functions, create three small classes unrelated by inheritance---clases Building, Car and Bicycle.
Calculate the geometric mean of numbers : Write a program to calculate the geometric mean of numbers entered by a user. The program should prompt the user to enter numbers and continue to accept the numbers until the user enters 999.
Make a fourth button called special : Make a fourth button called "special" that does something else notdescribed in the assignment, such as change the background color.
Write a c function called values that returns void : Write a C function called values that returns void and takes two double precision arguments (called a and b) and one double precision array argument.
Trojan horse defense : Using your favorite search engine, look up "Trojan Horse Defense". How can it be used to question the conclusions drawn from a forensic investigation? Site a case where it was used.
Write a java program that uses a search tree of strings : Write a Java program that uses a search tree of strings to sort text lines in alphabetic order. You may choose how you de?ne alphabetic order as long as there is some sense in the de?nition. You may also choose what kind of tree you use.

Reviews

Write a Review

 

MATLAB Programming Questions & Answers

  The body fat percentage

The body fat percentage (BFP) of a person can be estimated by the formula BFP= 1.2xBMI+0.23xAGE -10.8xGEnder-0.54 where BMI is the body mass index, given by BMI = 703 W/H^2, in which W is the weight in pounds and H is the height in inches

  Consider the predator-prey models

Consider the predator-prey models developed early part of the 20 th  century in which the number of predators and preys may be predicted using the pair of ODEs

  Compare with the true value

compare with the true value of 6.737947 x 10 -3  . Use 20 terms to evaluate each series and compute true and approximate relative errors as terms are added.

  Generate by means data.m an array

Generate by measdata.m an array A withsize (365,24), containing temperature measurements for an entire year [1 January,..., 31 December], 24 hours a day [00.00h,...,23.00h].

  Filtering – biomedical application

Prepare a filter that removes noise produced by electronic medical equipment.

  Determine the size for variables used in matlab program

If b=3, a=6 how many loops would the given program do? what will be the out put for z(4)? what would be size (in rows and columns) for variables z, i and b?

  Coding(using for and while loop)

coding(using for and while loop)

  Explore the design of a recursive digital filter

In this simulation we are going to explore the design of a recursive digital filter which might be usedvin a digital radio station. The sampling frequency used in digital radio (DAB) is either 48 kHz or 24 kHz and for the purposes of this simulation,

  Create a matrix of 5x6

Prepare a matrix of 5x6. with identical columns and rows ranging from 200 to 1000 in equal increments

  Solve the differential equation

Find a general solution of the following differential equation and solve the differential equation

  Matlab program to compute how much money will accumulate

Write a MATLAB program to compute how much money will accumulate in 5 years in the account and in any CDs you buy. Run the program for two different savings interest rates: 4 percent and 5 percent.

  Create an animation of a square

create an animation of a square according to the directions below. Create a square with a side length of 3 with the square centered at (5,5). Translate this square along a cosine wave on the interval [0, 6*pi].

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd