ISYES = YESNO waits for a keypress of either the Y-key or N-key and returns a logical one (true) if the Y-key was pressed, and a logical zero (false) if the N-key was pressed.
fprintf('\nHere is a number for you: %5.0f', 1000*rand)
fprintf('\nDo you want another number (y/n)? ') ;
if yesno, fprintf(' %5.0f', 1000*rand) ;
else fprintf('\nBye!\n') ;