1/2z not z/2PHP Code:double z;
double x = 2.229;
int r=10,d=2;
double y=(int)((z=pow(r,d))*(x+(1/(2*z))))/z;
cout<<y<<endl;
btw you have to swap the factors since first term evaluates first, and z is in the second - will cause the the addition to be in vain.






Reply With Quote