hello, i have been trying to write this following forgram in c for the past couple of days but i can not get my head around it. the program can only be written in C with C standard libraries. your help will be much appreciated.
Please take the array {
Solution
#include <stdio.h>
#include <stdlib.h>
void duplicate(int a[], int n)
{
int i, j, count=0;
for(i = 0; i < n; i++)
for(j = i+1; j < n; j++)
if(a[i] == a[j])
{
printf(\" \ Value \");
printf(\" %d \", a[i]);
printf(\" was found at indices: %d, %d \", i,j);
count++;
}
printf(\" \ Total dublicate found:%d \", count);
}
int main()
{
int a[]={47,48,58,123,456,789,188,0,3000,47,939,2373,1873,283,948,333,283,2835,248,444,555,732,1983,473,939,3000,7,9,2496,1729,1776,11,12,84,126,120,-1};
int n;
n=sizeof(a)/sizeof(a[0]);
duplicate(a,n);
return 0;
}
.