Home › Forums › C Programming › invalid operands of types `float’ and `int’ to bin › Reply To: invalid operands of types `float’ and `int’ to bin
October 28, 2007 at 6:25 pm
#3260
msaqib
Participant
Hello
Well there is a sligh problem with your code. You are using ^ as a power operator but there is no such operator which performs the power operations. This operator (^) is a bitwiase operator to calculate XOR.
To calculate the power you can use pow(double x, double y) function. It will calculate x power y.
Also make sure you include math.h header in your program as pow function is defined is this header file.
So your function should look like
1 2 3 4 5 6 7 8 9 10 11 | void circle()<br /> {<br /> double r=0.0;<br /> double m=2.0;<br /> double area=1;<br /> printf("enter area");<br /> scanf("%lf",&r);<br /> area =PI* pow(r,m);<br /> printf("%lf",area);<br /> getch();<br /> } |