Write a function that takes an array of floating point values,
An integer that tells how many floating point values are in the array. The function must reverse the order of the value in the array
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace C_SHARP
{
class Program
{
static void Main(string[] args)
{
Console.Write("How many floating point values are in the array?: ");
int n = int.Parse(Console.ReadLine());
float[] floatNumbers = new float[n];
for (int i = 0; i < n; i++) {
Console.Write("Enter float number: ");
floatNumbers[i] = float.Parse(Console.ReadLine());
}
Console.WriteLine("Reverse the order of the value in the array");
reverseArray(floatNumbers,n);
Console.ReadKey();
}
/// <summary>
/// a function that takes an array of floating point values,
/// An integer that tells how many floating point values are in the array. The function must reverse the order of the value in the array
/// </summary>
/// <param name="floatNumbers"></param>
/// <param name="n"></param>
static void reverseArray(float[] floatNumbers, int n)
{
for(int i=n-1;i>=0;i--){
Console.WriteLine("{0}", floatNumbers[i]);
}
}
}
}
Comments
Leave a comment