[go: up one dir, main page]

0% found this document useful (0 votes)
33 views3 pages

Remove The Duplicates Elements in Array June 26, 2014

The document describes a program to remove duplicate elements from an array in VB.NET. It includes the aim, procedures, coding, and output of the program. The program takes user input for the number of elements and values in an array, then uses nested for loops to compare each element to others and flag duplicates with a variable. Non-duplicate elements are outputted.

Uploaded by

Amutha Arun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views3 pages

Remove The Duplicates Elements in Array June 26, 2014

The document describes a program to remove duplicate elements from an array in VB.NET. It includes the aim, procedures, coding, and output of the program. The program takes user input for the number of elements and values in an array, then uses nested for loops to compare each element to others and flag duplicates with a variable. Non-duplicate elements are outputted.

Uploaded by

Amutha Arun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

3.

REMOVE THE DUPLICATES ELEMENTS IN ARRAY June 26, 2014




12PA01 Page 7

Aim:
~~~~
To write a program to perform removes the duplicates elements in array using
vb.net.
Procedure:
~~~~~~~~~

Step1: Start the program in the Microsoft Visual Studio 2010.
Step2: File->new->project Select the project type as visual basic and select
the visual studio installed template as console application.
Step3: Choose a Name, Location and Solution name.
Step4: Declare the variables.
Step5: Get the input values.
Step6: To find the duplicate element using the for loop.
Step7: To remove the duplicate elements with the help of flag value.
Step8: End of the program.











3. REMOVE THE DUPLICATES ELEMENTS IN ARRAY June 26, 2014


12PA01 Page 8

Coding:
~~~~~~
Module Module1

Sub Main()
Dim a(30) As Integer
Dim i, j, f, n As Integer
f = 0
Console.WriteLine("Remove the duplicate number in an array")
Console.WriteLine("**********************************")
Console.WriteLine("Input")
Console.WriteLine("~~~~")
Console.WriteLine("Enter the no of element")
n = Console.ReadLine()
Console.WriteLine("Enter the element")
For i = 1 To n
a(i) = Console.ReadLine()
Next i
Console.WriteLine("Output")
Console.WriteLine("~~~~~")
For i = 1 To n
For j = i + 1 To n
If (a(i) = a(j)) Then
f = f + 1
End If
Next j
If f = 0 Then
Console.WriteLine(a(i))
End If
f = 0
Next i
Console.ReadKey()
End Sub
End Module


3. REMOVE THE DUPLICATES ELEMENTS IN ARRAY June 26, 2014


12PA01 Page 9

Output:
~~~~~~
Remove the duplicate number in an array
**********************************
Input
~~~~
Enter the no of element
6
Enter the element
6
5
3
3
7
4
Output
~~~~~
6
5
3
7
4




Result:
*****
Thus the remove the duplicate elements in the array program was successfully
performed.

You might also like