A problem

R. Van Nieuwenhuyze shared this question 2 months ago
Answered

Hello,

A list contains 6 elements.

With which code is it possible to control that 2 elements of the list have only 1 difference of each other?

l1={34,5,67,35,1,78} is OK because abs(34 - 35) = 1.

l2={34,5,17,8,19,12} is not OK.

Thanks for a solution!

Rodger.

Comments (5)

photo
1

Hi

in this file, a="ok" or a="not ok" if list l1 is ok or not

photo
1

Hello jumera;

Thanks a lot!

It is OK!

Rodger.

photo
1

No problem (...)

Happy for you...

photo
1

work of junera says {34, 5, 67, 35, 1, 68} is not ok

change a to If(Sum(l3) > 0, "ok", "not ok") if you want {34, 5, 67, 35, 1, 68} is ok

photo
1

Hello mathmagic,

Thanks for your comment!

Rodger.

© 2020 International GeoGebra Institute