Guest User

Untitled

a guest
Dec 17th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void main()
  4. {
  5. int array[100], i, num;
  6.  
  7. printf("Enter the size of an array \n");
  8. scanf("%d", &num);
  9. printf("Enter the elements of the array \n");
  10. for (i = 0; i < num; i++)
  11. {
  12. scanf("%d", &array[i]);
  13. }
  14. printf("Even numbers in the array are - ");
  15. for (i = 0; i < num; i++)
  16. {
  17. if (array[i] % 2 == 0)
  18. {
  19. printf("%d \t", array[i]);
  20. }
  21. }
  22. printf("\n Odd numbers in the array are -");
  23. for (i = 0; i < num; i++)
  24. {
  25. if (array[i] % 2 != 0)
  26. {
  27. printf("%d \t", array[i]);
  28. }
  29. }
  30. }
Add Comment
Please, Sign In to add comment