- #1
GE2014
- 11
- 0
Homework Statement
(see attached file)
Homework Equations
(see attached file)
The Attempt at a Solution
isbn=input('Enter 9 Letter ISBN number: ','s');
for i=1:1:length(isbn)
(%indent)num=str2num(cat);
(%indent)check=num*i
%somewhere in here I need code to add all the checks found in the loop
end
checksum=mod(check%not correct,11)
So I have gotten the loop to visit all the digits separately and multiply it by the loop variable. Now all I need is some way to add all of those values into one. From there I use the modulus function and that's basically it. My prof gave a few hints. She said an if statement would be used, but that's probably for when the mod of the value will equal 10 and I need to display an X.
Also, I'm assuming I need to use a string concatenation at some point since it reminds me about it. Will that be used to put together the output at the end?
I realize this is probably a very simple exercise but this is my first effort using loops so I'm still trying to get a grasp on it
Attachments
Last edited: