Wednesday, 25 February 2015
Sunday, 1 February 2015
Take an array copy it to another and reverse it [Console application]
Take an array copy it to
another and reverse it
Console application
Module Module1
Sub Main()
Dim arr(4), arr1(4) As Integer
Dim i As Integer
For i = 0 To arr.Length - 1
Console.WriteLine("Enter {0} element of array:", i + 1)
arr(i) = Convert.ToInt32(Console.ReadLine())
Next
Array.Copy(arr, arr1,
arr1.Length)
'Array.Copy(source,
destination, Destination Length)
Array.Reverse(arr1)
For i = 0 To arr1.Length - 1
Console.Write("Enter {0} element of array in Reverse
order:", i + 1)
Console.WriteLine(arr1(i))
Next
Console.ReadLine()
End Sub
End Module
Output:-
Subscribe to:
Posts (Atom)