0

Pushing entry to an array

I wrote a code to spawn pythagoras numbers i,j,k like 3,4,5 or 6,8,10 and so on. I set the 3 numbers as an entry to an array. How do I avoid adding entry when i is the same as j? For instance I want just 3,4,5 to be added to the array without adding 4,3,5. Or adding 6,8,10 without adding 8,6,10 and so on. https://code.sololearn.com/WBfVE8RroS1I/?ref=app

13th Oct 2018, 4:33 AM
Fernando Moceces
Fernando Moceces - avatar
3 ответов
+ 1
if(i*i+j*j==k*k && i<j && j<k){ r=i+" "+j+" "+k; a.push(r); b=a.join("<br>"); pytaoutput.innerHTML=b; } would be the easiest way I think.
13th Oct 2018, 8:08 AM
Anton Böhler
Anton Böhler - avatar
+ 1
Thanks brooo 😀
13th Oct 2018, 8:46 AM
Fernando Moceces
Fernando Moceces - avatar
0
seemingly works
13th Oct 2018, 8:09 AM
Anton Böhler
Anton Böhler - avatar