import java.util.Scanner;

/**
   This program reads, scales and reverses a sequence of numbers.
*/
public class Reverse
{
   public static void main(String[] args)
   {        
      double[] values = readInputs(5);
      multiply(values, 10);
      printReversed(values);
   }

   /**
      Reads a sequence of floating-point numbers.
      @param numberOfInputs the number of inputs to read
      @return an array containing the input values
   */
   public static double[] readInputs(int numberOfInputs)
   {
      System.out.println("Enter " + numberOfInputs + " numbers: ");
      Scanner in = new Scanner(System.in);
      double[] inputs = new double[numberOfInputs];
      for (int i = 0; i < inputs.length; i++)
      {
         inputs[i] = in.nextDouble();
      }
      return inputs;
   }

   /**
      Multiplies all elements of an array by a factor
      @param data an array
      @param factor the value with which element is multiplied
   */
   public static void multiply(double[] data, double factor)
   {
      for (int i = 0; i < data.length; i++)
      {
         data[i] = data[i] * factor;
      }
   }

   /**
      Prints an array in reverse order
      @param data an array of numbers
      @return an array that contains the elements of data in reverse order
   */
   public static void printReversed(double[] data)
   {
      // Traverse the array in reverse order, starting with the last element
      for (int i = data.length - 1; i >= 0; i--)
      {
         System.out.print(data[i] + " ");
      }
      System.out.println();
   }
}
