Question: Write a script that keeps getting a number from the user. If that number is positive, print positive; negative, print negative. If it is zero,

 Write a script that keeps getting a number from the user.

Write a script that keeps getting a number from the user. If that number is positive, print positive; negative, print negative. If it is zero, print zero and then stop. Demonstrate with any sequence that mixes positives and negatives before giving it zero.+ Partial credit for doing this for just one input number (ie, no loop)H' Step by Step Instructions:+ * Start with the if statement. Get a number from the user and print out if it is positive. Check that it works by inputting a positive, then a negative, then a zero. It should only print something if the number is positive+ . Now add the first elseif-in this case, check to see if the number is negative.*' o Check again with positive, zero, and negative nothing should be printed for the Now add the final elseif, You could use else with no condition; not incorrect, just doesn"t o BTW NaN stands for not a number- if you see this, you've gone and divided zero zero catch not a number (see below)+' by zero or something like that. . Now wrap the whole thing in a while loop.+' o What should the stopping criteria be?+ o There are two ways to do this: + Either put an * outside of the loop AND inside of the loop to setx*- OR " take advantage of the fact that you know what you're check for and just set x to be any other number before the loop . I prefer this because it's "safer" if you change the input statement

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!