homework assistance needed.

I'm taking a programming class this semester and I need help with my homework below. I'm studying electrical engineering, but i have to take this class. Your help will be greatly appreciated!!

Program Description:
Compute the value of e^x where x is specified by the user. Compare results with the exp() function in the math library.

Program Requirements:
1. Prompt the user for x, and get user input.
2. Verify x is a real number and -5 ≤ x ≤ 11, otherwise display an error message and exit with an error.
3. Compute the value of ex with the following series:

until the computed value is less than 1 × 10-10 of the value returned by exp().
4. Print the following values separated by tabs:
a. x to 10 digits to the right of the decimal
b. the value of exp() to 10 digits to the right of the decimal
c. the number of terms computed
d. the sum computed to 10 digits to the right of the decimal
e. the absolute value of the difference between the value of exp() and the sum computed in scientific notation to 10 digits to the right of the decimal
5. Exit with no error upon completion.

Test Cases:
Show the program output for x = -8.739, -5, -0.9, 0, 7.53, 11, 16.2251

Notes:
Here is an example of using exp():
result = exp(x);

Another function in the math library that might prove useful is fabs(). Here is an example:
delta = fabs(a - b);

Sample Output:
(Where x = 1)

This program estimates e^x.
Enter x (-5 <= x <= 11): 1
1.0000000000 2.7182818285 14 2.7182818284 1.2285727991E-011
This is all i have....not sure where to go from here



HOMEWORK #1*/

#include <stdio.h>

int main(void)
{
int xray, counter, sum, ee, delta;

printf("Please enter a number\n"); /*asking user for number*/
scanf("%d", &xray); /*number stored in x*/

if ((xray>=-5) && (xray<=11)){

printf("results!\n");
}
else{
printf("please select a number greater than -5 and less than 11\n");

}
return 0;

Topic archived. No new replies allowed.