Problem
1. Write a program in C# Sharp to read user input number of values in an array
and display it in reverse order.
Source Code:
using System;
using [Link];
using [Link];
using [Link];
namespace ReverseArray
{
class Program
{
static void Main(string[] args)
{
//1. Write a program in C# Sharp to read user input number of values in
an array and display it in reverse order.//
int[] ArrayNum = new int [100];
int x, num;
[Link]("How many number do you want to input? ");
num = Convert.ToInt32([Link]());
[Link]("\nEnter a number:\n");
for (x = 0; x < num; x++)
{
[Link]("", x);
ArrayNum[x] = Convert.ToInt32([Link]());
}
[Link]("\nThe numbers inputted are : \n");
for (x = 0; x < num; x++)
{
[Link]("{0} ", ArrayNum[x]);
}
[Link]("\n\nThe numbers in reverse order :\n");
for (x = num - 1; x >= 0; x--)
{
[Link]("{0} ", ArrayNum[x]);
}
[Link]();
}
}
}
Output: