Question
i have part 3 as follows could you help me with part 4 (write the c code). #include int main() { int n,i,j; double result
i have part 3 as follows could you help me with part 4 (write the c code).
#include
int main()
{
int n,i,j;
double result = 0;
printf("Enter n value: ");
scanf("%d", &n);
for(i=0, j=1; i if(i%2 == 0) result = result + (1/(double)j); else result = result - (1/(double)j); } result = 4 * result; printf("PI value: %lf ", result); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started