Before I go any further, this is separate from my homework. However, in the part with which I have problems, it is not the main task of the assignment.
For assignment, we simply store the numbers in the array and add the elements of the array through multithreading.
The user enters the number of threads that they would like to start, and what should be the upper limit.
For example: Upper bound: 12 Topics: 2 The application should contain elements 1-6, and then 7-12. In this case, the lower bound starts from 1, and the upper bound starts from 6. Then the second time the loop should iterate, the upper bound should be 7, and the upper bound should be 12.
I am having trouble trying to divide the upper bound by the number of threads to create increments in which the lower and upper bounds are based on.
It is quite simple if the number of threads is evenly divided by the initial upper bound. But when it is not, when I had a problem.
source share