Explore BrainMass
Share

Implementing a pseudocode m-file function with two inputs

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

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

© BrainMass Inc. brainmass.com October 24, 2018, 5:57 pm ad1c9bdddf
https://brainmass.com/computer-science/matlab/implementing-pseudocode-mfile-function-inputs-26635

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