Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void) {
  5.  
  6. int array[100]= {};
  7. int x = 0;
  8. int i;
  9. int j=0;
  10.  
  11. i=0;
  12. while(i < 100 && (scanf("%d", &array[i])==1)) {
  13. i++;
  14. }
  15.  
  16. printf("Odd numbers were: ");
  17.  
  18.  
  19. while(j < i) {
  20. if(array[j]%2!=0) {
  21. printf("%d ", array[j]);
  22. }
  23. j++;
  24. }
  25.  
  26. printf("\n");
  27.  
  28. printf("Even numbers were: ");
  29. j=0;
  30. while(j < i) {
  31. if(array[j]%2==0) {
  32. printf("%d ", array[j]);
  33. }
  34. j++;
  35. }
  36.  
  37. printf("\n");
  38.  
  39.  
  40.  
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement