Newer
Older
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