google search

Popular Posts


Welcome to BCA Notes

>>>>>>>>>>>>>>>>

Visitors

Search This Blog

Blogger templates

Visitor Map


Thursday 29 January 2015

How to reverse a array using function in Console application



How to reverse a array using function in
Console application

Source code:-

Module Module1
    Sub Main()
        Dim arr(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.Reverse(arr)
        For i = 0 To arr.Length - 1
            Console.Write("Enter {0} element of array in Reverse order:", i + 1)
            Console.WriteLine(arr(i))
        Next
        Console.ReadLine()
    End Sub
End Module

OUTPUT:-

0 comments:

Post a Comment