/*---------------------------------------------------*/ /* Program chapter2_2 */ /* */ /* This program uses linear interpolation to */ /* compute the coefficient of lift for an angle. */ #include #include int main(void) { /* Declare variables. */ double a, f_a, b, f_b, c, f_c; /* Get user input from the keyboard. */ printf("Use degrees for all angle measurements. \n"); printf("Enter first angle and lift coefficient: \n"); scanf("%lf %lf",&a,&f_a); printf("Enter second angle and lift coefficient: \n"); scanf("%lf %lf",&c,&f_c); printf("Enter new angle: \n"); scanf("%lf",&b); /* Use linear interpolation to compute new lift. */ f_b = f_a + (b-a)/(c-a)*(f_c - f_a); /* Print new lift value. */ printf("New lift coefficient: %6.3f \n",f_b); /* Exit program. */ return 0; } /*---------------------------------------------------*/