Question: Nrite a program that reads a sequence of integer inputs and uses a while loop and and if/else statement to print the number of ever
Nrite a program that reads a sequence of integer inputs and uses a while loop and and if/else statement to print the number of ever odd inputs. We will prompt the user with Enter an integer (Q to quit): Ex. If the inputs are 3,6,79,12,Q it would took like this for the input: Enter an integer (Q to quit): 3 Enter an integer ( Q to quit): 6 Enter an integer (Q to quit):7 Enter an integer ( Q to quit): 9 Enter an integer ( Q to quit): 12 Enter an integer (Q to quit): Q and this for the output: The user entered 2 even values and 3 odd values. Ex: If the inputs are 4,11,24,5,9,2,9, and entire run of the program would be: Enter an integer (Q to quit ):A Enter an integer (0 to quit): 11 Snter an integer (Q to quit) : 2 Bnter an integer (Q to quit): 24 Enter on integer (Q to quit) i 5 Enter an integer (0 to quit) i 9 Enter an integer (Q to quit) 2 Bnter an integor ( 0 to quit): Q The user entered 3 even values and 3 odd values. You can find on example of a while loop using Q ' o5 a sentinel on p.137 in Section 4.3. Remember to determine is a number is even or odd
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
