How to create a array of type double and have compile time initialiser placing 10 values in two arrays. Storing the product of two arrays in the third array.

To create array the Syntax is

DataType [] ArrayName = new DataType ;

Ex

double [] array1 = new double [10];

To initialize
DataType [] ArrayName = new DataType { Initialize data };
Here Size is optional
Ex

double [] array1 = new double [] {1.0,2.0,3.0,4.0};

or

double [] array1 = {1.0,2.0,3.0,4.0};

only for primitives.

use for loop for each array and calculate the product and store it

for dynamic arrays use List<double>, works like an ArrayList

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.