Homework #4

Homework #4 - /* MAE9: Homework #4, Fall 2008 Turnin by...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 /* MAE9: Homework #4, Fall 2008 Turnin by Monday, October 27, by 9:00pm A mathematical relationship between x and y is described by the following expressions: y= A*x^2-B*x^3+x/4 if x<=0 (Case 1) y=A*x-B*x^4+C if 0<x<1 (Case 2) y=A*log10(x)-B/x-2*C if x>=1 (Case 3) where A, B, and C are constants. Write a C program that reads the double values of the constants A,B,C, and the argument x (by using scanf), and computes the corresponding value of y. Print x by using %f format with 4 decimal places, and print y by using %f format with 5 decimal places. Use the pow(a,b) function to calculate x^2, x^3 and x^4, and if/else statements to choose the proper expression for y, corresponding to selected x. After reading A,B,C, your program should use a do/while loop to evaluate y for scanned x in each of the above three cases. If you scan x from the same interval again, your program should ask you to scan x from another interval, until you scan x once from each interval. ................................................................ Your output should look like:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/10/2009 for the course MAE MAE 9 taught by Professor Lubarda during the Fall '08 term at UCSD.

Page1 / 3

Homework #4 - /* MAE9: Homework #4, Fall 2008 Turnin by...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online