i making a small function that asks the user to give 5 number so it calculates the average of it.
How do i keep the user from putting invalid values, say i want only values between 1 and 100 to count and reask the user if input wrong
as of now i have this
number1 = input('first number: ') %this 4 more times but +1 ofcourse
average = number1+.. /5;disp('average is: ')disp(average)
now if the user input is 0 or 101 or 500 something out of boundaries how do i ask the user to put in a valid number?
say number 1 is correct and user get prompt number 2 but types invalid number how do i reask it.
i've googled a bit but most answers dont fit my way.
thanks in advance!
Best Answer