I have the following problem:
"Using a while loop, find the first element and its index in the variable "a" that is greater than 0.42 and less than 0.52. Make sure that your code does not evaluate indices greater than 20"
I wrote the following code:
while a(n) < 0.42 && a(n) > 0.52
However, absolutely nothing happens (no output is dispalyed) and I don't understand why. Can somebody please explain to me what I'm doing wrong?
I also don't know how to write the code so that it doesn't evaluate indices greater than 20. Can I use an if statement inside the while loop? Although I'm not sure how to do that exactly. Does anybody have any hints maybe?