Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4.  
  5. int main () {
  6.  
  7. int i, count = 0;
  8. double arr_nums[100];
  9. double num, sum = 0, mean, stdev, lowd = 0, highd = 0, climit, dlimit;
  10. http://pastebin.com/i/t.gif
  11. printf("Enter next number, EOF to stop > ");
  12.  
  13. while(scanf("%lf", &num) != EOF) {
  14. arr_nums[count] = num;
  15. count++;
  16. printf("Enter next number, EOF to stop > ");
  17.  
  18. }
  19. }
  20. if (count > 9) {
  21. for(i = 0; i < count; i++) {
  22. sum += arr_nums[i];
  23. }
  24.  
  25. mean = sum/count;
  26.  
  27. for(i = 0; i < count; i++) {
  28. stdev += (1/(count - 1))*pow((arr_nums[i] - mean), 2);
  29. }
  30.  
  31. printf("Mean = %.2f, Standard Deviation = %.2f\n", mean, stdev);
  32.  
  33. }
  34.  
  35. else {
  36. printf("**You must enter atleast 10 scores***");
  37. }
  38.  
  39. climit = mean;
  40. dlimit = mean - stdev;
  41.  
  42. printf("Scores above %.2f get a D\n", dlimit);
  43. printf("Scores above %.2f get a C\n", climit);
  44.  
  45. for(i=0; i < count; i++) {
  46. if(arr_nums[i] >= dlimit && lowd > arr_nums[i]) {
  47. lowd = arr_nums[i];
  48. }
  49. else {
  50. lowd = lowd;
  51. }
  52. if(arr_nums[i] < climit && highd < arr_nums[i]) {
  53. highd = arr_nums[i];
  54. }
  55. else {
  56. highd = highd;
  57. }
  58. }
  59.  
  60. printf("The lowest score to get a D is %.2f\n", lowd);
  61. printf("The lowest score to get a D is %.2f\n", highd);
  62.  
  63. return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement