fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. int main()
  5. {
  6. int i, n;
  7. int odd =0;
  8. int even=0;
  9. int A[15];
  10. srand(time(NULL));
  11. for (i=0; i<n; i++){
  12.  
  13. A[i]=rand()%60-10 ;
  14. printf(" %d ", A[i]);
  15. }
  16. for(i=0; i<n; i++)
  17. {
  18. if(A[i]%2==0)
  19. even++;
  20. else
  21. odd++;
  22.  
  23. }
  24. printf("\neven numbers in array: %d",even);
  25. printf("\n odd numbers in array: %d",odd);
  26.  
  27.  
  28. }
Success #stdin #stdout 0s 5568KB
stdin
Standard input is empty
stdout
even numbers in array: 0
 odd numbers in array: 0