Variable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

1st May 2022, 5:56 AM
BLESSING UZOMA NWOYE
27 Answers
+ 3
And I guess it helpful to share the complete challenge/task.
1st May 2022, 6:32 AM
Denise Roßberg
Denise Roßberg - avatar
+ 2
It is not helpful to a beginner to get ready-made code without any explanation.
1st May 2022, 9:32 AM
Lisa
Lisa - avatar
+ 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
1st May 2022, 6:34 AM
Lisa
Lisa - avatar
+ 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; }
1st May 2022, 9:29 AM
Muhammed Shibil M
Muhammed Shibil M - avatar
0
Hello BLESSING UZOMA NWOYE In which language? In python: x = 7 print(x**3)
1st May 2022, 6:20 AM
Denise Roßberg
Denise Roßberg - avatar
0
Re-read the previous lessons. It will be explained there. If you need help, please show us what you tried
1st May 2022, 6:22 AM
Lisa
Lisa - avatar
0
If you don't show your code, we can't know what is wrong.
1st May 2022, 6:31 AM
Lisa
Lisa - avatar
0
This is it
1st May 2022, 7:16 AM
BLESSING UZOMA NWOYE
0
What am i doing wrong
1st May 2022, 7:17 AM
BLESSING UZOMA NWOYE
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.
1st May 2022, 7:26 AM
Denise Roßberg
Denise Roßberg - avatar
0
It wenttttt
1st May 2022, 7:30 AM
BLESSING UZOMA NWOYE
0
Thank youuuuu
1st May 2022, 7:30 AM
BLESSING UZOMA NWOYE
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); } }
1st May 2022, 11:03 PM
joshua
joshua - avatar
0
Diana Create a new thread, write down your question, tag the relevant programming language and link your code.
2nd May 2022, 12:53 PM
Lisa
Lisa - avatar
0
Diana No, create your own thread and show your code attempt.
2nd May 2022, 12:59 PM
Lisa
Lisa - avatar
0
Create an algorithm for code U want to take in two numbers as the arguement then produce output
2nd May 2022, 1:23 PM
joshua
joshua - avatar
- 1
Yes python… was that exactly what u keyed in cux i am out of options
1st May 2022, 6:21 AM
BLESSING UZOMA NWOYE
- 1
I went through everything i know Num =7 Print (num) Num= 7 ** 3 Print ( num)
1st May 2022, 6:25 AM
BLESSING UZOMA NWOYE
- 1
Only print the result, not the initial number. Mind that print starts with "p" instead of "P"
1st May 2022, 6:27 AM
Lisa
Lisa - avatar
- 1
Still wrong
1st May 2022, 6:30 AM
BLESSING UZOMA NWOYE