Professional Documents
Culture Documents
Editor Window:
Approach: Ask the user for coordinate inputs which are stored as 4
different variables. Implement an equation that relates these variables to
calculate distance
Command Window:
Editor Window:
Problem #3: Write a program that shows the piecewise functions depending on the value input by users
Approach: Create variables using user input. Use if and elseif statements to output functions depending on the
values of the variables and a while loop to run code multiple times.
Command Window:
Editor Window:
Editor Window:
Problem 5: Create a matrix whose values are based on the values of the indices
Approach: Create a matrix of zeros, then replace them with values based on the value of the indices. Use an if
statement to assign values depending on whether the sum is odd or even as determined by mod operator.
Command Window:
Editor Window:
Editor Window:
Editor Window: