answersLogoWhite

0

#include

int main(){

int arr[50];

int *p;

int i,j,k,size,n;

printf("\nEnter size of the array: ");

scanf("%d",&n);

printf("\nEnter %d elements into the array: ",n);

for(i=0;i

scanf("%d",&arr[i]);

size=n;

p=arr;

for(i=0;i

for(j=0;j

if(i==j){

continue;

}

else if(*(p+i)==*(p+j)){

k=j;

size--;

while(k < size){

*(p+k)=*(p+k+1);

k++;

}

j=0;

}

}

}

printf("\nThe array after removing duplicates is: ");

for(i=0;i < size;i++){

printf(" %d",arr[i]);

}

return 0;

}

By Amandeep Singh :)

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

What is the algorithm using c to delete duplicate elements from an array?

To detect the duplicate, you will have to write a nested loop that compares each element with all the previous elements.To actually delete the duplicate, once you find it, you have to move over all the elements after the duplicate. If the order of the elements doesn't matter, it is faster to just move the LAST array element, overwriting the duplicate element. Use a variable to keep track how many elements of the array are "usable". For example, if your array had 10 elements, and you delete 1, the array size will still be 10... but (after moving the elements over) only 9 of those elements have useful information.


How do you write c program to perform sum of elements of matrix using pointers with functions?

i cant write


HOW TO SOLVE 'C' problem?

1. write a 'c' program to read 4(four)numbers from a file 'BANK' and calculate the average of the numbers.Now print the calculated average in another output file 'AVERAGE' 2. write a 'c' program that finds the sum and average of inputted five integer numbers of the array using dynamic memory allocation function malloc(). 3. write a 'c' program to create simple elements 1,2,3,4 in the link list of 4(four)nodes and display the list's elements. 4. write a 'c' program to convert the expression (A+B)/(C+D) into postfix expression into stack.and then evaluate it for A=10,B=20,C=15,D=5 and display the stack status after each operation. 5. write a 'c' programto create a linked list implemented on an array containing the following numbers:1,2,3,3,3,4,4,9 and pack it to remove the duplicate numbers.so that only the following data are contained by the nodes:1,2,3,4,9


How do you write a java program to find the transpose of the matrix for the given elements?

You basically write a nested for loop (one for within another one), to copy the elements of the matrix to a new matrix.


Write a C program using dynamic memory allocation to find the sum of elements of a matrix?

Did you know that memory allocation is not needed to display the matrix? However, the C program is to find the sum of all the elements.


How do you write a program that calculates the sum of the matrix elements given numbers?

ring me and ill explain - 086 22222222222222227 ring me


What tool is used to duplicate blocks on TheVoxelBox in Minecraft?

write&quot;/more&quot; in comands


How to write program for secant method in mathematica?

How to write a program for secant method by mathematica


How can I stop Open Office Writer from inserting a date 01slash04slash09 when I write 1-4?

I tried to duplicate your 'error' - and it didn't do it on my copy of writer (OpenOffice version 3.3) - However, in the Calc program, it did change the format. The solution there, was to re-format the cell.


Write a program in Lex to eliminate white space and collect numbers as a token?

write a lex program to delete space from the program


How do you write Square program using vb?

write a vb program to find the magic square


Write a program to multiply 33 matrix.?

write a program to multily 3*3 matrix.

Trending Questions
What software allows users to create access and manage a data base? What is the volume of fluid in the human body? If a patient who has had major abdominal surgery receives intravenous fluids equal to the blood volume lost during surgery would you expect urine volume to be greater or less than why? Which command is used to configure a static ARP entry using the MAC address of AAAA.BBBB.DDDD towards the IP address of 10.41.82.11? Do you have the rights to claim a song as yours for monetization purposes on Youtube if the song has been remixed to a certain extent? What is the full command line for the loopback address test? What are the differences between direct thermal printer and thermal wax transfer printer? What to do if none of the function keys do not allow you to access bios I have tried every F key and still can't get in to bios setup. The machine does not display any opening screen.? What is a typical application for SCSI devices? What does the OR function do in Excel? What are the importance of spread sheet? Who owns SUSE Linux? Do the green material slow down access speed of computer? How are printers classified? Can windows 7 use 4GB of DDR3 ram? what tools and technology did Hernando De Soto use when he was on his exploration? What is the best way to prevent virus from entering your computer? Program binaries in many systems are typically structured as follows.Code's stored starting with a small fixed virtual address such as 0.What is the significance of that structured on the pure paging? Do rats like bird seed? How can you restore Hard Drives back into your computer?