Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Suppose we read n random integer numbers into an array declared by int x[100].
- We know that all the integer numbers arebetween 0 and 10.
- Write aprogram to find how many 0’s ,1’s, ..., 10’s exist in the array x.*/
- #include<stdio.h>
- int main()
- {
- int n, x[100], y[11] = {0};
- scanf("%d", &n);
- for (int i = 0; i < n; ++i)
- {
- scanf("%d", &x[i]);
- y[x[i]] += 1;
- }
- for (int i = 0; i <= 10; ++i)
- {
- printf("Frequency of %d\'s: %d\n", i, y[i]);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment