Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main () {
- int i, count = 0;
- double arr_nums[100];
- double num, sum = 0, mean, stdev, lowd = 0, highd = 0, climit, dlimit;
- http://pastebin.com/i/t.gif
- printf("Enter next number, EOF to stop > ");
- while(scanf("%lf", &num) != EOF) {
- arr_nums[count] = num;
- count++;
- printf("Enter next number, EOF to stop > ");
- }
- }
- if (count > 9) {
- for(i = 0; i < count; i++) {
- sum += arr_nums[i];
- }
- mean = sum/count;
- for(i = 0; i < count; i++) {
- stdev += (1/(count - 1))*pow((arr_nums[i] - mean), 2);
- }
- printf("Mean = %.2f, Standard Deviation = %.2f\n", mean, stdev);
- }
- else {
- printf("**You must enter atleast 10 scores***");
- }
- climit = mean;
- dlimit = mean - stdev;
- printf("Scores above %.2f get a D\n", dlimit);
- printf("Scores above %.2f get a C\n", climit);
- for(i=0; i < count; i++) {
- if(arr_nums[i] >= dlimit && lowd > arr_nums[i]) {
- lowd = arr_nums[i];
- }
- else {
- lowd = lowd;
- }
- if(arr_nums[i] < climit && highd < arr_nums[i]) {
- highd = arr_nums[i];
- }
- else {
- highd = highd;
- }
- }
- printf("The lowest score to get a D is %.2f\n", lowd);
- printf("The lowest score to get a D is %.2f\n", highd);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement