Home / EG Comp Lab / C Language / Remove duplicate elements from keyboard: C Program

Remove duplicate elements from keyboard: C Program

This C program remove same elements from given list.

This program visit each numbers if number is visited again then remove that number.For example  given array= 1, 2, 1, 3, 4, 2, 5, 4. After removing duplicate elements from the given array we get elements=1, 2, 3, 4, 5.

[message_box title=”PROGRAM” color=”yellow”]

/* Written by Utpal Chaudhary  */

/* Student of L.D COLLEGE OF ENGINEERING, Ahmedabad-15, Gujarat */

#include <stdio.h>

#include <conio.h>

void main()


int m[10], i, k=0, j, n,store[10], flag;


printf(“How many elements ?”);

scanf (“%d”, &n);

printf ( ” Enter %d  elements (with some duplication) \n “,n );

for( i=o;i<n; ++i)


scanf ( “%d “,&m[i] );


for(j=0; j<k ; ++j)


if ( m[i]==store[j] )












printf (“After removing duplicate elements \n”);

for(j=0; j<k ; ++j)


printf (” %d \n”,store[j] );



[message_box title=”NOTE” color=”green”]

NOTE :- You can also run this program without using second array.



About Utpal

I am third year student of computer engineering in L.D COLLEGE OF ENGINEERING,Ahmedabad.

Check Also

Game-Theoretic Pricing for Video Streaming in Mobile Networks

ABSTRACT Mobile phones are among the most popular consumer devices, and the recent developments of …

Leave a Reply

Be the First to Comment!

Notify of