Hi guys, I am attempting this, but cannot put finger on what is wrong. I have done it assuming a unit circle on origin and I thus use the positive quadrant and multiply the answer by 4.

Think maybe to do with the way I have generated random numbers.

Many thanks for your ideas..

insert
Code:

#include<stdlib.h>
#include<stdio.h>
#include<math.h>
int main()
{
int N=100000,j;
double x1,x2,hit;
x1=rand()/(double)RAND_MAX; //insuring random numbers between 0,1
x2=rand()/(double)RAND_MAX;
for(j=0;j<N;j++)
if(x1*x1+x2*x2<=1)
{
hit++;
}
printf("volume: %f", (4.0*hit)/N);
system("pause");
exit(0);
}