I have a simple problem, but as a beginner I'm struggling to find the answer. So I would really appreciate some help.
I have two double [] arrays (A and B), with 10 values. There is also a simple formula (P = A + B + temp(square)). Everything is calculated in the loop.
Here is the code:
double[] arrayA = new double[] {
1.2 * Math.Pow(10, -3),
1.6 * Math.Pow(10, -3),
1.9 * Math.Pow(10, -3),
2.2 * Math.Pow(10, -2),
2.6 * Math.Pow(10, -2),
3 * Math.Pow(10, -4),
3.6 * Math.Pow(10, -4),
4,
0.5 * Math.Pow(10, -3),
40,
};
double[] arrayB = new double[] {
3.2 * Math.Pow(10, -5),
6.4 * Math.Pow(10, -5),
1.2 * Math.Pow(10, -4),
2.4 * Math.Pow(10, -4),
4.8 * Math.Pow(10, -4),
9.6 * Math.Pow(10, -4),
2 * Math.Pow(10, -3),
4 * Math.Pow(10, -3),
8 * Math.Pow(10, -3),
1.6 * Math.Pow(10, -2),
};
double[] result = new double[arrayA.Length];
for (int i = 0, j = 0; i < result.Length; i++, j++)
{
result[i] = arrayA[i] + arrayB[j] * Math.Pow(303, 2);
Console.WriteLine("P" + (i + 1) + " = " + result[i]);
}
Console.ReadLine();
I want to find values from both arrays, where their first numbers (firstNumber*Math.Pow(x,y))
are whole numbers. Afterward, I want to do the formula only for these elements in which the first numbers are whole.
Hope this makes sense.
Thank you in advance.
Marko.
Comments
Post a Comment