Try to ans this??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Try to ans this???

for any c programming... { int x=10, num; num=x**2; printf("%d",num); } for any c programming...the power of operator doesn't works....but some another languages...like python and other some languages works ....power of operator... why....???

6th May 2018, 2:55 AM
Purushoth Sharma
Purushoth Sharma - avatar
2 Answers
+ 4
Because different languages have different syntax. The proper way is as pointed out by Faisal.
6th May 2018, 3:17 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
In C, there isn't a default power operator like in most languages, so your best option would be to use the pow() function in the math.h library. #include <math.h> int main(){ int x = 10; int num = pow(x,2); printf("%d",num); return 0; }
6th May 2018, 3:10 AM
Faisal
Faisal - avatar