Could you just store the values into two separate arrays and wait until both threads complete before printing anything?

Is there a mutex or semaphore synchronization method that you could use so...