How to make a conclusion of numbers from an array, so that there would be an alternation of even and odd? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make a conclusion of numbers from an array, so that there would be an alternation of even and odd?

How to make a conclusion of numbers from an array, so that there would be an alternation of even and odd? I can only draw a conclusion in ascending and descending order

8th May 2020, 9:00 PM
GAG98
GAG98 - avatar
2 Answers
+ 2
Hello GAG98 Can you give an example?
8th May 2020, 10:20 PM
Denise Roßberg
Denise Roßberg - avatar
0
Here an example. Enter numbers separates by spaces. - Check if the first number is even. - Loops through the rest - Check if modulo 2 returns equal result for index (i) and number - Check if that outcome is equal to the even check from the beginning https://code.sololearn.com/csRu4xIz16xF/?ref=app
8th May 2020, 10:23 PM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar