# How to Write a C language in a Program?

**Question description**

Type your programming question here...

how to create multiple threads program in c. The program requires two command line arguments to be executed and they are

1-numthreads-n integer value that specifies how many threads will be created.

2-increment-the number of integer values that each thread will work with.

the program creates the specified number of threads and assigns to each one of them an interval of integer values say{a ,b} where (a) is the starting value and (b-1) is the end value. Each thread computes a value (S) which is

if your student-id mod3=0, then the summation of the integers in its interval, that is: a+(a+1)+(a+2).....+(b-2)+(b-1). In other word you compute the sum of the integers.

if your student-id mod 3=1 then the summation of the squares of integers in its interval that is

a^2+(a+1)^2+(a+2)^2....+(b-2)^2+(b-1)^2.In other words you compute the sum of squares.

If your student-id mod3=2 then the product of integers in its interval, that is

a(a+1) (a+2).......(b-2)(b-1).In other word you compute the factorial.

Finally, compute the time it takes to execute the programme. Also, extend the program further so that each thread will compute the time it takes to execute individually and print the result.

## Tutor Answer

**Quality**

**Communication**

**On Time**

**Value**

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors