Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int main()
  6. {
  7. int arrayMaster[10];
  8. int arraySlaveOne[5];
  9. int arraySlaveTwo[5];
  10. srand(time(0));
  11.  
  12.  
  13.  
  14. for (int i = 0; i < 10; i++)
  15. {
  16. int numbers = rand() % 9 + 1;
  17. arrayMaster[i] = numbers;
  18. printf("%i ", arrayMaster[i]);
  19. }
  20. printf("\n");
  21. for (int j = 0; j < 10; j++)
  22. {
  23. if (j < 5)
  24. {
  25. arraySlaveOne[j] = arrayMaster[j];
  26. printf("%i ", arraySlaveOne[j]);
  27. }
  28. printf("\n");
  29. if (j > 4 && j < 10 )
  30. {
  31. arraySlaveTwo[j - 5] = arrayMaster[j];
  32. printf("%i ", arraySlaveTwo[j - 5]);
  33. }
  34.  
  35. }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement