0% found this document useful (0 votes)
38 views2 pages

Power Progress

The document describes an exponential multiplication problem where a user inputs two numbers - the base and the power. The program calculates the exponential power of the base from 1 to the power input. It checks that both inputs are positive numbers and the base is less than the power. It then displays the results sequentially.

Uploaded by

Nikhil nani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views2 pages

Power Progress

The document describes an exponential multiplication problem where a user inputs two numbers - the base and the power. The program calculates the exponential power of the base from 1 to the power input. It checks that both inputs are positive numbers and the base is less than the power. It then displays the results sequentially.

Uploaded by

Nikhil nani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Power Progress

Grade settings: Maximum grade: 100


Disable external file upload, paste and drop external content: Yes
Run: Yes Evaluate: Yes
Automatic grade: Yes
Andrews taught exponential multiplication to his daughter and gave her two inputs.

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.

Adhere to the code template, if provided.

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

You might also like