guess - if r == 1 getnum = input('Guess a number between 0...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% 3/2/11 % Exam 1 Practice % function [a] = guess(getnum) num = round (rand (1) * 100); r = 1; while r == 1 if getnum < num disp ('That is too low'); elseif getnum > num disp ('That is too high'); else disp ('Correct!'); break end r = input('Do you want to guess again 0(no) 1(yes)? ');
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if r == 1 getnum = input('Guess a number between 0 and 100: \n'); end end if getnum ~= num a = fprintf ('You lose the number was %d', num); end end...
View Full Document

This note was uploaded on 05/01/2011 for the course HCSC 110 taught by Professor Amosjohnson during the Spring '11 term at Morehouse.

Ask a homework question - tutors are online