Answer to Question #192796 in C# for Resego

Question #192796

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


1
Expert's answer
2021-05-13T02:46:34-0400
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]);
            }
         
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS