Duplicate values removal from array


Duplicate values removal  from array:

//removal duplicate values from array 
#include<iostream>
using namespace std;
void main()
{
int a[8]={1,2,3,3,4,1,2,1};
int b[8]={0,0,0,0,0,0,0,0};
b[0]=a[0];
for(int i=1;i<8;i++)
{
int counter=0;
for(int j=0;j<i;j++)
{
if(a[i]==b[j])
counter++;
}
if(counter>0)
b[i]=0;
else
b[i]=a[i];
}
for(int k=0;k<8;k++)
{
if(b[k]!=0)
cout<<b[k]<<" ";
}
cout<<endl;
}

Download:

To download this code click on the given link below:

Comments

  1. Arithmetic operations in Assembly Language are a testament to the power of low-level programming. With precise control over registers and instructions, these operations unlock the potential for blazing-fast calculations .

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Run Assembly Language Programming Code In Visual Studio 2019

How to Display Table of any Number in Assembly Language

How to Display Character in Assembly language