Question: 3) Given the following pseudo code, write the python program? You program accepts number and doubles it and displays the result. Tis happens until you


3) Given the following pseudo code, write the python program? You program accepts number and doubles it and displays the result. Tis happens until you enter a negative number once a negative number is entered the program exits. 10 marks for double the number and displaying the number 10 marks for making the while loop work as described in the problem Psuedo Code // Variables needed to hold input, intermediate values, and results // To quit enter a negative number Declare Integer numToDouble Declare Integer result // Prints out a blank line and instruction Display Display "Enter number would you like to double and press Enter." read from console Input num ToDouble // Start of loop and check for sentinel value While numToDouble>0 // Calculates and displays result Set result numToDouble 2 Display "2X ", numToDouble,"-",result // Prints out a blank line and instructiorn Display Display "Enter number would you like to double and press Enter.* // Reads next user input Input numToDouble End While //Quitting message Display "OK, you entered a value0, ending execution
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
