Question
Powers of 2 - a collaborative program ASSIGNMENT: Write a program that asks the user for a number between 1 and 2 0 . The
Powers of 2 - a collaborative program ASSIGNMENT: Write a program that asks the user for a number between 1 and 2 0 . The program will then display the powers of 2 up to the number entered. If the number entered is not between 1 and 2 0 , inform the user and re-ask for the number until a number in the range of 1 through 2 0 is entered. This program will require a loop (use a while loop) to validate the number entered, and will also require a loop (use a for loop) for the powers of two. Example Run #1: ( bold type is what is entered by the user) Enter an integer (between 1 and 20): 5 2^ 1 = x 2^2 = x 2^3 = x 2^4 = xx 2^5 = xx Example Run #2: Enter an integer (between 1 and 20): 25 The integer entered, 25, is not in the range of 1 to 20. Please re-enter the integer: 5 2^ 1 = x 2^2 = x 2^3 = x 2^4 = xx 2^5 = xx IN C PLEASE!!!!Powers of 2 - a collaborative program ASSIGNMENT: Write a program that asks the user for a number between 1 and 2 0 . The program will then display the powers of 2 up to the number entered. If the number entered is not between 1 and 2 0 , inform the user and re-ask for the number until a number in the range of 1 through 2 0 is entered. This program will require a loop (use a while loop) to validate the number entered, and will also require a loop (use a for loop) for the powers of two. Example Run #1: ( bold type is what is entered by the user) Enter an integer (between 1 and 20): 5 2^ 1 = x 2^2 = x 2^3 = x 2^4 = xx 2^5 = xx Example Run #2: Enter an integer (between 1 and 20): 25 The integer entered, 25, is not in the range of 1 to 20. Please re-enter the integer: 5 2^ 1 = x 2^2 = x 2^3 = x 2^4 = xx 2^5 = xx IN C PLEASE!!!!Powers of 2 - a collaborative program ASSIGNMENT: Write a program that asks the user for a number between 1 and 2 0 . The program will then display the powers of 2 up to the number entered. If the number entered is not between 1 and 2 0 , inform the user and re-ask for the number until a number in the range of 1 through 2 0 is entered. This program will require a loop (use a while loop) to validate the number entered, and will also require a loop (use a for loop) for the powers of two. Example Run #1: ( bold type is what is entered by the user) Enter an integer (between 1 and 20): 5 2^ 1 = x 2^2 = x 2^3 = x 2^4 = xx 2^5 = xx Example Run #2: Enter an integer (between 1 and 20): 25 The integer entered, 25, is not in the range of 1 to 20. Please re-enter the integer: 5 2^ 1 = x 2^2 = x 2^3 = x 2^4 = xx 2^5 = xx IN C PLEASE!!!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started