Answer:
value=int(input("Enter the value from where the user wants to starts: "))#Take the value from the user.
i=1#intialize the value of a variable by 1.
while(value<1000) and (i<9):#while loop which prints the value.
print(value,end=" ")# print the value.
value=value*2#calculate the value to print.
i=i+1#calculate the value for the count.
Output:
If the user enter 5, then the output is : "5 10 20 40 80 160 320 640".
If the user enter 5, then the output is : "3 6 12 24 48 96 192 384".
Step-by-step explanation:
- The above code is in python language, in which the first line of the program is used to render a message to the user, take the input from the user and store it into value variable after converting it into an integer.
- Then the loop will calculate the double value and then it prints the value with the help of print function.
- The end function puts the spaces between numbers.