What happens when you use the fuction inside two loops? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What happens when you use the fuction inside two loops?

Um using two loops to calcular distância, só I wanna stop at one precisly step, like when stop the interior loop, strart the superior loop. Check the code below. https://code.sololearn.com/c9UsQa6Kkxy4/?ref=app

16th Jun 2019, 11:43 AM
Isaac Muniz
Isaac Muniz - avatar
1 Answer
+ 1
Please notice that power of 2 and square root would cancel each other out. So this line if (sqrt(pow(rx[j][i],2)) > p1) is equivalent to if ( rx[j][i] > p1 ) _________ List of errors and warnings in the code: 1. the array `rx[]` is a linear list (one-dimensional array). However, it's been misused in two places as `rx[j][i]` which is a two-dimensional array. 2. The variable `p1` hasn't been defined. 3. The array `fi[]` also hasn't been defined. 4. The header `#include <math.h>` hasn't been included.
16th Jun 2019, 12:02 PM
To Seek Glory in Battle is Glorious
To Seek Glory in Battle is Glorious - avatar