Skip to content
Snippets Groups Projects
module5_multiplication_game.m 392 B
Newer Older
  • Learn to ignore specific revisions
  • vand's avatar
    vand committed
    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