Results 1 to 2 of 2

Math Help - MATLAB help

  1. #1
    Newbie
    Joined
    Apr 2010
    Posts
    14

    Post MATLAB help

    Write an M-File that asks the user for the population of an area and prints out a result according to the following rules:

    1) Print “Invalid population” if user enters 0 or a negative value
    2) Print “Village” if population is between 1 and 999 inclusive
    3) Print “Town” if population is between 1000 and 49999 inclusive
    4) Print “City” if population is 50000 or above

    Try to avoid redundant comparisons in your code.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member
    Joined
    Mar 2007
    Posts
    206
    Awards
    1
    you will need to use an "if" statement and the "input" command. You could also use switch case statement.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Matlab help
    Posted in the Math Software Forum
    Replies: 1
    Last Post: February 11th 2010, 02:59 AM
  2. Matlab FFT Help
    Posted in the Math Software Forum
    Replies: 0
    Last Post: June 3rd 2009, 12:48 PM
  3. help about ODE in matlab
    Posted in the Math Software Forum
    Replies: 1
    Last Post: May 31st 2009, 03:10 AM
  4. Matlab
    Posted in the Math Software Forum
    Replies: 0
    Last Post: November 6th 2008, 08:46 AM
  5. Matlab
    Posted in the Calculus Forum
    Replies: 3
    Last Post: August 20th 2008, 10:39 PM

Search Tags


/mathhelpforum @mathhelpforum