Skip to content

Commit

Permalink
Merge pull request tarunsinghofficial#477 from Gaurav1707/patch-1
Browse files Browse the repository at this point in the history
Create Array Duplicacy
  • Loading branch information
tarunsinghofficial committed Oct 20, 2020
2 parents b06cf2b + ce4c706 commit b18be7b
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Array Duplicacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <stdio.h>
int main() {
int array[1000] ;
int i,n,j,k;
printf("Input the number of elements to store in the array :");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("element - %d : ",i);
scanf("%d",&array[i]);
}
for ( i = 0; i < n; i++)
{
for (j = i+1; j < n;j++)
{
if (array[j]==array[i])
{
for ( k = j; k < n; k++)
{
array[k]=array[k+1];
}
j--;
n--;
}
}
}
printf("Original content is\n");
for(i = 0; i < n; i++)
{
printf("%d ", array[i]);
}
return 0;
}



0 comments on commit b18be7b

Please sign in to comment.