#include<iostream.h>
#include<conio.h>
void main()
{
int array[10],i,j,c,n;
cout<<"Enter integers: ";
for(i=0;i<10;i++)
cin>>array[i];
for(i=0; i<10; i++)
{
if (array[i]== -1)
continue;
n=array[i];
c=1;
for(j=i+1 ; j<10; j++)
{
if (array[j]==n)
{
c++;
array[j]=-1;
}
}
cout<<n<<" is stored "<<c<<" times in the array<<endl;
}
getche();
}
No comments:
Post a Comment
If you have any doubt please let me know