Display
Array in Reverse form
Reverse the element of array
class Program
{
public static void ReverseAnArray(int[] arr)
{
for
(int i = arr.Length - 1; i >=
0; i--)
{
Console.Write(arr[i]+"\t");
}
}
static void Main(string[] args)
{
Console.WriteLine("How to find out the reverse of an array \n");
Console.WriteLine("Enter array Size");
int
arraysize = Convert.ToInt32(Console.ReadLine());
int[]
arr = new int[arraysize];
Console.WriteLine("Enter the array Value");
for
(int i = 0; i <= arraysize -
1; i++)
{
arr[i]= Convert.ToInt32(Console.ReadLine());
}
Program.ReverseAnArray(arr);
Console.ReadLine();
}
}
No comments:
Post a Comment