Question: Ask the user to enter a sequence of numbers. Let's call this sequence A. Thereafter ask the user to enter a number B. A number
Ask the user to enter a sequence of numbers. Let's call this sequence A. Thereafter ask the user to enter a number B.
A number is considered good if it is a positive power of B. So B, B*B, B*B*B, B*B*B*B*B are examples of good numbers. Output all the good numbers in the list A. You may assume list A contains no duplicate numbers.
Sample Output 1:
Please enter A: 9 31 20
Please enter B: 3
The good numbers present are 39
The order in which you output which are present does not matter. You need only consider positive powers of B. So B, B*B, B*B*B and so on. Sample Output 2:
Please enter A: 931 20 11 2 1024 8
Please enter B: 2
The good numbers present are 2 8 1024
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
