Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C# program that asks a user for a whole number and prints out the factor

ID: 3862142 • Letter: W

Question

Write a C# program that asks a user for a whole number and prints out the factorial of that number. The program should use three threads (or tasks) to complete the computation. One thread computes the factorial up to first third, the second thread should compute the factorial of the middle third, and the third thread computes factorial of the last third. A final thread multiplies all three results to get the final answer. For example, to compute 25!:

25 divided into three approximately equal parts = 8+8+9

Thread1 (or Task1): Result1 = 1*2*3*4*5*6*7*8

Thread2 (or Task2): Result2 = 9*10*11*12*13*14*15*16

Thread3 (or Task3): Result3 = 17*18*19*20*21*22*23*24*25

Final result (Thread/Task4) = Result1*Result2*Result3

Print Final result.

Compare the result of computing the factorial by using a sequential loop and printing the answer.

Which method is faster?

How did you determine which method is faster?

Explanation / Answer

Compare the result of computing the factorial by using a sequential loop and printing the answer.

Normal method of finding factorial is faster.Because it requires less loop.For the implimented method we need to create 3 therds and need to manage that threads.In each step we need to save

The result and finally we need to multiply the result to get final result which results in processing more time

How did you determine which method is faster?

It depends on how many loops are required to get the solution and depends on the number of line of code .if more lines of code speed will be lesss.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote