StoneHaos

Untitled

Mar 27th, 2020
177
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. const int n = 10;
  6. int arr[2][n + 1], mass[n], cnt[2];
  7.  
  8. int main(void) {
  9.     srand(time(NULL));
  10.     for (int i = 0; i < n; ++ i) {
  11.         mass[i] = rand() % 100 + 1;
  12.         int mod = mass[i] % 2;
  13.         arr[mod][cnt[mod]] = mass[i];
  14.         ++ cnt[mod];
  15.         printf("%d ", mass[i]);
  16.     }
  17.     printf("\n\n");
  18.     for (int i = 0; i < 2; ++ i) {
  19.         for (int j = 0; arr[i][j] != 0; ++ j) {
  20.             printf("%d ", arr[i][j]);
  21.         }
  22.         printf("\n");
  23.     }
  24.     return 0;
  25. }
RAW Paste Data