Question: Write a function in Matlab that takes a 3 digit number as an input and outputs the sum of the each individual digit of the
Write a function in Matlab that takes a 3 digit number as an input and outputs the sum of the each individual digit of the provided input. For ex. If the input is 456 output should
be 4+5+6. The function should work for any 3 digit Number
Use the following format on the first line:
function [sum]=LastName_FirstName(num)
Test your function for: (i)113 (ii535 (iii986 (iv) 283. Copy the command window results showing the function calls and the output and paste this into your function
file as a comment
Hint: try using division on the input combined with the built-in MATLAB function floor() to isolate each individual digit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
