Friday, December 05, 2008

Merging the array values

Before writing the actual code I tested this arrays to calculate has to be done on one array and another will be as it is.


double[] Pre = new double[3];
Pre[0] = 1;
Pre[1] = 2;
Pre[2] = 3;
double[] Pre1 = new double[3];
Pre1[0] = 4;
Pre1[1] = 5;
Pre1[2] = 6;
string n1 = "";
string n2 = "";

for (int i = 0; i < Pre.Length; i++)
{
n1 = n1 + "-" + Pre[i].ToString() + ",";

}
for (int a = 0; a < Pre1.Length; a++)
{
n2 = n2 + Pre1[a].ToString() + ",";
}

string result = n1 + n2.TrimEnd(',');

Response.Write(result.ToString());