C Language, Assignment #2, Due Feb 7, '08
1. Write a program that prompts for two variables lower_value and upper_value. Then, read variables until the user enters -30000. Your program should count the number of values that were in the range of lower_value to upper_value. On completion, print this counter.
For example, assume the user inputs the lower_value as 7 and the upper_value as 12. The user then inputs 1, 2, 3, 6, 8, 8, 12, 12, 13, -3000. The counter should be four.
2. Throw a pair of dice 10000 times. Count the number of occurrences of numbers 10, 11 and 12. Print the number of occurrences and the percentage.
3. Generate a table evaluating the function;
y = sin(x) / x
at NUM_PTS equidistant points over the range x = 0 to 2 * PI You might debug with NUM_PTS set to 20. Once you get it going, you can set NUM_PTS to a higher value, say 100. Avoid division by zero.
The output should be separated by a comma. For example;
0.513, 0.234
Write this to a file.
Then, use a spreadsheet program to import this file and plot it.
4. Develop a program to use trial and error to solve;
e^x = x