Share
Explore BrainMass

Implementing a pseudocode m-file function with two inputs

Convert the following structure plan into a function m-file with two inputs (M and N):

Get M and N values
if M does not equal round(M)
Give error message that inputs must be integers
end if
if N does not equal round(N)
Give error message that inputs must be integers
end if
while remainder of M divided by N is not zero
Set R to the remainder of M divided by N
Set M to be N
Set N to be R
end while
Return final value of N as output

Solution Preview

function result=twonumbers(m,n)
%to run the program, type twonumbers(m,n) where m and n are ...

Solution Summary

Help to convert the following structure plan into a function m-file with two inputs (M and N) is given.

$2.19