Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Program to print the values of those bases and exponents whose exponentiation gives the same power value. Also print the corresponding power value.
(Range:
Initial value:- Base >= 2, Exponent >= 1
Terminal value: User Input )

Sample Input:
Enter the values of the base and exponent for range:
5
5

Sample Output:
Base = 2, Exponent = 2;
Base = 4, Exponent = 1;
Power value = 4

Base = 2, Exponent = 4;
Base = 4, Exponent = 2;
Power value = 16

What I have tried:

Took two variables each for base and exponent in python and tried it but the result was something else very simple and different from what is required.
Tried using Matrix in C too but result was different and I was stuck in between.
Posted
Updated 22-Jan-23 0:21am
Comments
Richard MacCutchan 22-Jan-23 11:49am    
That is really a mathematics question. And once you have solved that, writing the code should be much easier.

1 solution

Quote:
Write a program in any of the languages C, java or Python
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

And to be honest, even if we did write it for you, it probably wouldn't help: a Python solution wouldn't necessarily be directly useful in C or Java, and vice versa.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
Comments
CPallini 22-Jan-23 7:38am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900