Write a program in C/C++/Linux to find the mean and then use that mean for
further calculations. Make three threads to perform different task as follows:
a) The 1st Thread will find the mean.
b) The 2nd Thread will take the mean from the 1st Thread and display the numbers
that are greater than the mean.
c) The 3rd Thread will also take the mean from the 1st Thread and display the
factorial of the two numbers that are the closest to the mean.
d) The Thread#2 and Thread#3 will wait until the thread#1 complete its task, and
then terminate by giving an appropriate message on the screen.
This program should take user input from command line as follows to calculate the mean:
Sample output is shown below:
[prompt]# ./file 12 7 11 14 5 7 9 4 33 65
Output starts here
Thread 1 starts
Mean = 16.7
Thread 1 ends
Thread 2 starts
33 65
Thread 2 ends
Thread 3 starts
12! =
14! =
Thread 3 ends
End of output
sergent 52 Posting Pro
nidajaffri -1 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Salem 5,199 Posting Sage
nidajaffri -1 Newbie Poster
nidajaffri -1 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.