Created
October 23, 2016 16:28
-
-
Save ryzokuken/8a8aa94bc84c00334c6dc8967f8363b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void printArray(int array[], int length) { | |
int i; | |
for (i = 0; i < length; i++) { | |
printf("%d ", array[i]); | |
} | |
printf("\n"); | |
} | |
int main() { | |
int odd[10], even[10], c_odd = 0, c_even = 0, i; | |
for (i = 0; i < 10; i++) { | |
int input; | |
scanf("%d", &input); | |
if (input % 2) { | |
odd[c_odd] = input; | |
c_odd++; | |
} else { | |
even[c_even] = input; | |
c_even++; | |
} | |
} | |
printf("Printing Odd Array\n"); | |
printArray(odd, c_odd); | |
printf("Printing Even Array\n"); | |
printArray(even, c_even); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment