Write a program to input an array of 20 elements and then print an array consisting of only even numbers from the first array ( consisting 20 elements ) and another array consisting of odd numbers from the first array ( consisting of 20 elements )
Answers
Answered by
7
Input = {12, 34, 45, 9, 8, 90, 3}
Output = {12, 34, 8, 90, 45, 9, 3}
Answered by
4
Given an array A[], write a function that segregates even and odd numbers. The functions should put all even numbers first, and then odd numbers.
Example:
Input = {12, 34, 45, 9, 8, 90, 3}
Output = {12, 34, 8, 90, 45, 9, 3}
In the output, the order of numbers can be changed, i.e., in the above example, 34 can come before 12 and 3 can come before 9.
Similar questions