Write a script that first asks the user for a number (using the input command).Using an if statement, print out if this number is positive, negative or zero. Testyour script a few times to make sure it does the right thing for all three cases.o Put a break point in each branch of the if statemento Run the script and enter a negative number. Did you stop at the rightbranch? If so, un-click that break point. Repeat with a positive number andwith zero to check that you visit all three if statement branches.• Now copy your if statement and put it in a for loop that asks the user for input 10times so you don’t have to keep calling the script by hand. Remember thatcontrol-c will stop the loop.• Now change the for loop to a while loop that stops when the user inputs zero.What should your stopping condition be?o Hint: There are two ways to do this. One is to declare a “flag” variable thatis set to false before you start the while loop, eg stop = 0; while stop ==0… When you get an input that is zero, set stop to be true.o Second approach: Suppose you are using n as the variable you store theuser’s input in (eg n = input(‘Type a number’)). Declare n before the startof the while loop, setting it to some value other than zero. Then, check thevalue of n.
MATLAB: How to write a sript for while loop and for loop. please include code
doit4mefor and while loophomework
Best Answer