here is my code and thanks for your help in advance!
double theta, A1, A2, phi, C, A0, L ;
theta = 1;
A0 = 0.7;
L = 0.160;
C = sqrt(A0*A0 + L*L);
phi = atan(A0/L);
//**************************************************************************
if (C*C + L*L - 2*L*C*cos(phi - theta)>0.0);<---- Remove semicolon
{
A1 = sqrt(C*C + L*L - 2*L*C*cos(phi - theta));
}
else if (C*C + L*L - 2*L*C*cos(phi - theta)<0.0);<---- Remove semicolon
{
printf("error -- sqrt_negative\n");
}
if (C*C + L*L - 2*L*C*cos(phi + theta)>0.0);<--- Remove semicolon
{
A2 = sqrt(C*C + L*L - 2*L*C*cos(phi + theta));
}
else if (C*C + L*L - 2*L*C*cos(phi + theta)<0.0);<--- Remove semicolon
{
printf("error -- sqrt_negative\n");
}
I get these errors:
syntax error; found `if' expecting `;'
unrecognized statement