Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  17000
Language: PASCAL
Code:
     program monte_karlo;
var i, n, n1, longint;
    x, y, pi: real;
begin
  randomize;
write('Введите число точек: n=');
readln(n);
         for i:=1 to n do
    begin
    x:=random*2;
    y:=random*2;
    if sqr(x-1)+sqr(y-1) <=1 then n1:= n1 + 1;
    end;
  p:=4*n1/n;
  writeln('pi=',pi);
end.     
Comments: