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

Note..: some sample code can be found here in the link ... To calculate the valu

ID: 3861899 • Letter: N

Question

Note..: some sample code can be found here in the link ...

To calculate the value of Pi, we can use the graph of a circle and find the area under the graph. Riemann sum is an effective method for finding the area under the graph Write a PThreads Program that will calculate Pi It should run 8 threads Creat a global variable for the total sum Use a Mutex variable to lock the critical section where you sum the results The program should output the sum at each thread and the parent will output the total sum Copy this version and remove the Mutex variable run both versions and compare the output Deliverables Source Code Screen shots of output of both programs

Explanation / Answer

#include<stdio.h>

int main() {

   int rad;

   float PI = 3.14, area, ci;

   printf(" Enter radius of circle: ");

   scanf("%d", &rad);

   area = PI * rad * rad;

   printf(" Area of circle : %f ", area);

   ci = 2 * PI * rad;

   printf(" Circumference : %f ", ci);

   return (0);

}

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