• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Dec 3rd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include <stdio.h>
2. int main()
3. {
4.    int array[10], c, i, n, sum;
5.    float mean, array2[10], array3[10], mean2, mean3, kurtosis;
6.    float sumarray2, sumarray3;
7. printf("Enter the terms: \n");
8. c = 0;
9. n = 10;
10. array[0] = 0; array[1] = 0; array[2] = 0; array[3] = 0; array[4] = 0;
11. array[5] = 0; array[6] = 0; array[7] = 0; array[8] = 0; array[9] = 0;
12. for (c = 0; c < n; c++)
13. {
14.     printf("Please enter term %d: ", c+1);
15.       scanf("%d", &array[c]);
16.     if (array[c] < 0)
17.     {
18.         printf("you have entered a negative number\n");
19.         array[c] = 0;
20.         break;
21.     }
22. }
23. printf("\nYou have entered the maximum amount of values for the formula\n");
24. sum = array[0] + array[1] + array[2] + array[3] + array[4] + array[5] + array[6] + array[7] + array[8] + array[9];
25. mean = (float)sum / (float)c;
26. printf("\nThe number of terms = %d", c);
27. printf("\nThe mean is = %0.2f", mean);
28. for (i = 0; i < c; i++)
29. {
30. array2[i] = (array[i] - mean) * (array[i] - mean) * (array[i] - mean) * (array[i] - mean);
31. array3[i] = (array[i] - mean) * (array[i] - mean);
32. }
33. sumarray2 = array2[0] + array2[1] + array2[2] + array2[3] + array2[4] + array2[5] + array2[6] + array2[7] + array2[8] + array2[9];
34. sumarray3 = array3[0] + array3[1] + array3[2] + array3[3] + array3[4] + array3[5] + array3[6] + array3[7] + array3[8] + array3[9];
35. mean2 = sumarray2 / c ;
36. mean3 = sumarray3 / c ;
37. kurtosis = mean2 / (mean3 * mean3);
38. for (i = 0; i < c; i++)
39. {
40. printf("\nValue %02d: %d", i+1, array[i]);
41. }
42. printf("\nThe value of kurtosis is = %0.4f", kurtosis);
43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top