21.12.2016, 15:36
How do i calculate a power of x number in pawno? using ^ doesn't work.
This gives some odd kind of results. I am trying something like (x^2)*10.
It should have give these
x=1 - 10.
x=2 - 40.
x=3 - 90.
But instead it gives
x=1 - 30
x=2 - 0
x=3 - 10
This looks like '^' is acting as -2.
Code I used to test it
This gives some odd kind of results. I am trying something like (x^2)*10.
It should have give these
x=1 - 10.
x=2 - 40.
x=3 - 90.
But instead it gives
x=1 - 30
x=2 - 0
x=3 - 10
This looks like '^' is acting as -2.
Code I used to test it
Код:
printf("%d",(1^2)*10); printf("%d",(2^2)*10); printf("%d",(3^2)*10);