


p1=0;
x2=[];
y2=[];
a=input('Please enter the x value of the center of the circle:');
b=input('Please enter the y value of the center of the circle:');
r=input('Please enter the radius:');
n=1000;
for i=1:n
	x=randi([(a-r),(a+r-1)]);
	x1=x+rand();
	y=randi([(b-r),(b+r-1)]);
	y1=y+rand();
	r1=((x1-a)^2+(y1-b)^2)^.5;
	x2(end+1)=x1;
	y2(end+1)=y1;
	if r1< r
   	p1=p1+1;
	end
end
p=p1/n;
uncertanity= sqrt(p);
x=[(a-r),(a+r),(a+r),(a-r),(a-r)];
y=[(b-r),(b-r),(b+r),(b+r),(b-r)];
t=0:pi/50:2*pi;
h=cos(t)*r+a;
k=sin(t)*r+b;
plot (x,y,h,k,x2,y2,'.')
axis square;
axis([-20 20 -20 20])

