Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //input size and size number of integers, output range and frequencies
- #include <stdio.h>
- int main() {
- int arr[99] = { 0 }, aSize = 0;
- int sort[11] = { 0 }, sSize = 11;
- printf("Enter size: "); scanf("%d", &aSize);
- printf("Enter elements: ");
- for (int i = 0; i < aSize; i++) {
- scanf("%d", &arr[i]);
- }
- printf("Elements: ");
- for (int i = 0; i < aSize; i++) {
- printf("%d, ", arr[i]);
- sort[arr[i] / 10]++;
- }
- printf("\n\n range\t\tFrequency");
- for (int i = 0; i/10 < sSize; i+=10) {
- printf("\n %d\tto\t%d\t %d", i, i + ((i == 100) ? 0 : 9), sort[i/10]);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment