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
3 ответов
+ 2
Hello GAG98
Can you give an example?
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