diff --git a/module5_multiplication_game.m b/module5_multiplication_game.m new file mode 100644 index 0000000000000000000000000000000000000000..721e3df0dcbf724d03828f5477ed9ab950561ce1 --- /dev/null +++ b/module5_multiplication_game.m @@ -0,0 +1,17 @@ +disp('Welcome to multiplication game!') +disp('(Empty to quit)') + +s = 'start'; +while numel(s)>0 + a = randi([0, 9]); + b = randi([0, 9]); + s = input([num2str(a),'*',num2str(b),'='],'s'); + p = str2num(s); + if isempty(p) && ~isempty(s) + disp("I don't understand that.") + elseif p == a*b + disp('Good job!') + else + disp('Oh, no, try again.') + end +end \ No newline at end of file