## Question

###### Code that needs to be modified: #include #include #include int main() { int i,N,x; unsigned int seed; double R; printf("\nEnter number of iterations and seed"); printf("\n"); scanf(...

Code that needs to be modified:

#include

#include

#include

**int** main()

{

**int** i,N,x;

**unsigned** **int** seed;

**double** R;

printf("\nEnter number of iterations and seed");

printf("\n");

scanf("%i %u", &N,&seed);

srand(seed);

**for**(i=0;i

{

R=(**double**)rand()/RAND_MAX;

**if** (R<0.5)

x=x+1;

**else**

x=x-1;

}

printf("Final location is ");

printf("%d",x);

printf("\n");

}

Question: Write a code that generates N pairs of random numbers. Call the first member of each pair x and the second member y. Count how many of the N pairs obey x^2+y^2<1. Call that number M, and have your code print out M/N. What do you get for M/N when N=10^2? How about N=10^4, N=10^6 and N=10^8? Explain your result. The language used is C.

Hint: It might be useful to multiply the value you get for M/N by four.

Warning: Be careful how you define N and M. If you have variables N,M that are integers and compute N/M the computer will give you an integer which is the number of times M foes into N. Thus in N=5 an M=3 then N/M=5/3=1. Similarly if N=13 and M=2 then N/M=13/2=6. Finally, if N=1 and M=2 then N/M=1/2=0. if you want 13/2=6.5 you need to tell the computer 13 is a double (or float) by declaring it as a double(or float). This is an important point to remember in coding. If you ever write a line of C code like y=(1/2)*x; the computer will set y=0 because it will compute 1/2=0 before multiplying by x.

******* Please make sure you answer all the questions asked and please do it 100%correctly. Please write neat and very clear that way i can be able to read and understand what is being said. The language used is C.