HW006
Math 2984 - Fall 2017
Intro to Mathematical Problem Solving


TASK: Report the number of distinct values in X, Y, Z using IF/ELSEIF/ELSE.


COMMENT: A user will type in three numbers, and your script must report "The number of distinct values is 1" (or 2 or 3). If we only had X and Y to worry about, then the program would be something like this:

        if ( X == Y )
          print "The number of distinct values is 1."
        else
          print "The number of distinct values is 2."
      
but with three values to check, things become a little trickier.

Note the rules for how to write "equals" and "not equals" in logical expressions:

        if ( X == Y )  ...X equals Y...
        if ( X ~= Y )  ...X does not equal Y...
                          You'll need the "twiddle" character in the upper
                          left of your keyboard.
      


INSTRUCTIONS:

        Use the MATLAB input() command three times to get values
        "x", "y" and "z" from the user.

          x = ?;
          y = ?;
          z = ?;

        Define "n" to hold the number of distinct values and start it
        at 1, representing the value of x.

          n = 1;

        Now let's look at y.  If y is equal to x, we do nothing,
        but if y is not equal to x, we want to increase n by 1, 
        since we know we have two distinct values.

          if ( ? )
            ?
          end

        Now let's look at z.  How do we determine if z is a new value
        different from all the ones we have seen so far?  If z is
        not equal to x and z is not equal to y, then we should increase
        n one more time.

          if ( ? OR ? )
            ?
          end

        At the end, print your result something like this:

          fprintf ( ' Number of distinct values is %d\n', n );
      


SUBMIT: Your work should be stored in a script file called "hw006.m". Your script file should begin with at least three comment lines:

        % hw0006.m
        % YOUR NAME
        % This script (describe what it does)
        % Add any comments here that you care to make.
      
If this problem is part of an assignment, then submit it to Canvas.