+ 1

Anyone know's how to sort odd and even number with array in c language ? If you know please show me how to do it

8th Nov 2019, 4:14 AM
Susetyoadhi
5 Antworten
+ 5
I will give you basic idea of it, you have to code it yourself. See, create an array with some elements(odd and even both) Now in a for loop check every element like this a[i] % 2 == 0, cuz if that condition is true then it's even number else it's odd number. Code it 🤓
8th Nov 2019, 4:58 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
One way, while checking even or odd, if it comes even assign that into other array, if it is odd assign it into another array. So you have separate arrays for even and odd While printing print one odd, one even element using loops.. Be sure to stop printing, continue other if array sizes are not same.. You can get while coding... Hope this helps some...
8th Nov 2019, 7:55 AM
Jayakrishna 🇮🇳
0
Thank you though
8th Nov 2019, 5:11 AM
Susetyoadhi
0
But how to print it out with this order (even odd even odd, ...)
8th Nov 2019, 6:25 AM
Susetyoadhi
0
Well, thank's
8th Nov 2019, 11:29 AM
Susetyoadhi