//This Program tells the Frequency of Numbers in an array.
#include <iostream.h>
void main()
{
int a[10] = {1,2,2,2,3,3};
int f[10] = {0};
for (int i = 0; i<10 ; i++)
f[a[i]]++;
for (i = 1; i<10; i++)
cout << i <<" appears "<<f[i]<<" times."<<endl;
}
how to do the same for numbers below zero ?
ReplyDelete