How to raise a number to an exponent in C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

How to raise a number to an exponent in C

it seems x **y doesnt work in C, is there a way to do it?

24th Dec 2018, 2:50 PM
Nyakotey🇬🇭🎹
Nyakotey🇬🇭🎹 - avatar
6 Answers
+ 10
Nyakotey try it this way --> pow(x,y). This means x raised to the power of y. Don't forget to #include <math.h> *Edited*
24th Dec 2018, 2:53 PM
Ikechukwu Okonkwo
Ikechukwu Okonkwo - avatar
+ 9
Nyakotey you're welcome...Happy coding..😉😉😉
24th Dec 2018, 3:29 PM
Ikechukwu Okonkwo
Ikechukwu Okonkwo - avatar
+ 7
*Asterisk* that is true...Thanks for the correction..
26th Dec 2018, 3:09 PM
Ikechukwu Okonkwo
Ikechukwu Okonkwo - avatar
+ 3
thank you
24th Dec 2018, 3:27 PM
Nyakotey🇬🇭🎹
Nyakotey🇬🇭🎹 - avatar
+ 3
💫iYkE4LIFE💫 and Nyakotey it #include <math.h> he can use the pow(x,y); function.
26th Dec 2018, 11:18 AM
✳AsterisK✳
✳AsterisK✳ - avatar
25th Dec 2018, 10:14 AM
Anna
Anna - avatar