main.m306 chars6 lines
In the above code, we first prompt the user to enter a number using the input()
function and assign the value to the variable uservalue
. Then we start a while loop that checks for the two conditions: uservalue
must not be 10 and uservalue
must be less than 25. While both conditions are true, we multiply uservalue
by 2 using the arithmetic operation *
. Once either of the conditions is false, we exit the loop and display the final value of uservalue
using disp()
function.
gistlibby LogSnag