Autor Wiadomość
Ricko
PostWysłany: Nie 12:30, 08 Maj 2011    Temat postu: Punkty Kratowe - Informatyka (R)

Punkty Kratowe

Źródło: Praca na informatyce rozszerzonej

Cytat:
program kratki;

uses crt;

var
x,y,n:integer;
r:real;

begin
clrscr;
writeln('Podaj dlugosc promienia');
readln(r);

n:=0;

for x:=1 to trunc(r) do
begin
for y:=0 to trunc(r) do
begin
if ((x*x)+(y*y)) <= (r*r) then
n:=n+1;
end;

end;

n:=4*n+1;

writeln('Liczba punktow kratowych wynosi ', n);
readln;
end.

Powered by phpBB © 2001,2002 phpBB Group