Advertisement
MadCortez

Untitled

Mar 29th, 2021
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.48 KB | None | 0 0
  1. program Project2;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6.   SysUtils;
  7.  
  8. var
  9. y:real;
  10. k,n:integer;
  11. s:real;
  12.  
  13. function F(k:integer):real;
  14.  begin
  15.   if k<=n then
  16.    begin
  17.     result:= (((k)/(k - 1))*((k)/(k + 1)))*F(k+2);
  18.    end
  19.    else
  20.      result := 1;
  21.  end;
  22.  
  23.  
  24.  
  25. BEGIN
  26. y:=1;
  27.  
  28. writeln('vvedi n');
  29. readln(n);
  30.  
  31. writeln(F(2));
  32.  
  33. s:=1;
  34. k:=2;
  35. writeln('bez recursii');
  36.  repeat
  37.   s:=s*( ((k)/(k - 1)) * ((k)/(k+1)));
  38.   k:=k+2;
  39.  until k>n;
  40.  writeln(s);
  41.  
  42. readln;
  43. END.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement