Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The procedure INDECI reads; decimal numbers typed by the user. It has the follow

ID: 3862340 • Letter: T

Question

The procedure INDECI reads; decimal numbers typed by the user. It has the following specifications: input: none output: AX = binary equivalent of number DH = number of digits read DL = terminating character Write a procedure called FILL_ARRAY that calls INDECI to fill a word array by reading decimal numbers from the user. The user inputs decimal numbers on a single line. The numbers are separated by commas and the last number ends with a carriage return. The FILL_ARRAY procedure has the following specifications: input: BX = base address of array output: CX = number of decimal numbers read

Explanation / Answer

static void Main() { double[] array = new double[6]; Console.WriteLine("Please Sir Enter 6 Floating numbers"); for (int i = 0; i < 6; i++) { array[i] = Convert.ToDouble(Console.ReadLine()); } double sum = 0; foreach (double d in array) { sum += d; } double average = sum / 6; Console.WriteLine("==============================================="); Console.WriteLine("The Values you've entered are"); Console.WriteLine("{0}{1,8}", "index", "value"); for (int counter = 0; counter < 6; counter++) Console.WriteLine("{0,5}{1,8}", counter, array[counter]); Console.WriteLine("==============================================="); Console.WriteLine("The average is ;"); Console.WriteLine(average); Console.WriteLine("==============================================="); Console.WriteLine("would you like to search for a certain elemnt ? (enter yes or no)"); string answer = Console.ReadLine(); switch (answer) { case "yes": Console.WriteLine("==============================================="); Console.WriteLine("please enter the array index you wish to get the value of it"); int index = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("==============================================="); Console.WriteLine("The Value of the selected index is:"); Console.WriteLine(array[index]); break; case "no": Console.WriteLine("==============================================="); Console.WriteLine("HAVE A NICE DAY SIR"); break; } }