All pastes #360999 Raw Edit

Untitled

public text v1 · immutable
·published 2007-02-17 21:28 UTC
rendered paste body
program II;
uses crt;                                                                  {naudosimes jau parasytu programu biblioteka}
const e=0.00001;                                                           {e - konstanta}
var a,z    :real;                                                          {a ir z - racionalieji}
    n      :integer;                                                       {n - sveikasis}
    x      :array[0..10000] of real;                                       {ivedame masyva}
begin
clrscr;
window(20,10,65,20);
textbackground(yellow);
textcolor(blue);
clrscr;
writeln('Uzduotis 1, Variantas 2, Robertas Jurkaitis, 8 grupe');
writeln();
writeln('Iveskite bet koki teigiama skaiciu a');
readln(a);                                                                 {programa nuskaito skaiciu a}
 if a<=1 then x[1]:=0.95;                                                  {pasirenkame x[1]}
 if (a>1)and(a<=25) then x[1]:=a/5;
 if a>25 then x[1]:=a/25;
 n:=1;
  repeat
      x[n+1]:=(4*x[n]/5)+(a/(5*(x[n]*x[n]*x[n]*x[n])));
      z:=x[n+1]-x[n];
      x[n]:=x[n+1];
  until ((5*a)/4)*(abs(z))<e;
 writeln('Ivestojo skaiciaus penktojo laipsnio saknis  ', x[n+1]:8:5);     {isvedame rezultata i ekrana}
 writeln('Paspauskite bet kuri klavisa, kad baigti darba');
readln;
end.