Power Progress
Power Progress
Assume, the first input as M and the second input as N. He asked her to find the sequential
power of M until N times. For Instance, consider M as 3 and N as 5. Therefore, 5 times the power
is incremented gradually from 1 to 5 such that, 3^1=3, 3^2=9,3^3=27,3^4=81,3^5=243. The input
numbers should be greater than zero Else print “<Input> is an invalid”. The first Input must be
less than the second Input, Else print "<first input> is not less than <second input>".
Write a Java program to implement this process programmatically and display the output in
sequential order. ( 3^3 means 3*3*3 ).
Note:
In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given
by the user and the rest of the text represents the output.
Sample Input 1:
3
5
Sample Output 1:
3 9 27 81 243
Explanation: Assume the first input as 3 and second input as 5. The output is to be displayed are
based on the sequential power incrementation. i.e., 3(3) 9(3*3) 27(3*3*3) 81(3*3*3*3)
243(3*3*3*3*3)
Sample Input 2:
-3
Sample Output 2:
-3 is an invalid
Sample Input 3:
3
0
Sample Output 3:
0 is an invalid
Sample Input 4:
4
2
Sample Output 4:
4 is not less than 2