+ 2
Variable
Anyone know how to solve this. 7 is a variable and needs to be output raised to power 3. Tried everything but it’s not going https://sololearn.com/discuss/2991047/?ref=app
27 Answers
+ 3
And I guess it helpful to share the complete challenge/task.
+ 2
It is not helpful to a beginner to get ready-made code without any explanation.
+ 1
Go to Code section, click +, select the programming language, insert your code and save.
Com back to this thread, click +, Insert Code, sort for My Code Bits, select your code.
we need to see your COMPLETE CODE
+ 1
//using c language
//This code using get power of a number .
#include <math.h>
#include <stdio.h>
int main()
{
double x = 7, y = 3;
double result = pow(x, y);
printf("%.2lf", result);
return 0;
}
0
Hello BLESSING UZOMA NWOYE
In which language?
In python:
x = 7
print(x**3)
0
Re-read the previous lessons. It will be explained there.
If you need help, please show us what you tried
0
If you don't show your code, we can't know what is wrong.
0
This is it
0
What am i doing wrong
0
BLESSING UZOMA NWOYE
If you only need to print power of 3 than you should only do this.
Remove line 1, 2 and 3.
0
It wenttttt
0
Thank youuuuu
0
recursive method to get any power of a number
Java :
static int powerNum(int num, int exponent){
If(exponent <= 0){
return 1 ;
}
else{
return n * powerNum(num,exponent-1);
}
}
0
Diana Create a new thread, write down your question, tag the relevant programming language and link your code.
0
Diana No, create your own thread and show your code attempt.
0
Create an algorithm for code
U want to take in two numbers as the arguement then produce output
- 1
Yes python… was that exactly what u keyed in cux i am out of options
- 1
I went through everything i know
Num =7
Print (num)
Num= 7 ** 3
Print ( num)
- 1
Only print the result, not the initial number.
Mind that print starts with "p" instead of "P"
- 1
Still wrong