+ 1
Need help
there are two arrays. one array, for example, with dimensions 7.1, 7.56, 7.34, 7.23, 8.89, 9.1. the second array consists of numbers from 7 to 11, with a step of 0.01. it is necessary that in the second array, with a step of 0.16, a unit is displayed if the number is contained in the interval 7 to 7.16, if it is not contained, 0 is displayed For example: [7, 7.16] 1 [7.17, 7.33] 0 Dunno how to use cycles right in this case
5 Answers
+ 1
Show your code you tried
+ 1
static double[] xtao(int t1; int t2; double[] tk)
double[] mas = new double mas[1000];
int count = 0;
for (double i = (double) t1; i <= (double)t2; i+= 0.01)
{
mas[count] = i;
count++;
}
for (int n = 0; n < mas.Length; n++)
{
for(double j = (double) t1; j <= (double)t2; j+= 0.16)
{
if(mas.Contains(tk[n])) {mas[n] = 1;} else { mas[n] = 0;}
}
}
i know that it's not right and it's wrong to write that way but it was my last try from today. Have no idea what to do here anymore
0
And the input values?
0
Random numbers
t1 = 7, t2 = 11
double[] tk between 7 and 11
0
Random numbers in in the interval 7 and 11