Soy nuevo y nececito ayuda
Publicado por ale (1 intervención) el 06/11/2018 18:03:21

en si necesito realizar esto pero simplemente no me sale...
Ayuda por favor!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label9: TLabel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label10: TLabel;
Label11: TLabel;
Label13: TLabel;
Label14: TLabel;
Label16: TLabel;
Label17: TLabel;
Label21: TLabel;
Label22: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
Label28: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
Label15: TLabel;
Label33: TLabel;
Label34: TLabel;
Label35: TLabel;
x: TEdit;
n: TEdit;
Z: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
function factorial(n:integer):integer;
public
{ Public declarations }
end;
var
Form1: TForm1;
result:extended;
vir,res,opera:integer;
const
o = 0.577215601533;
implementation
{$R *.dfm}
Function Potencia ( x,n:integer ) : integer;
Var
i:integer; (* contador *)
pot:integer; (* variable potencia *)
Begin
pot:=1;
If n>0 Then
For i:=1 to n do
pot:=pot*x;
Potencia:=pot;
End;
function Tform1.factorial(n:integer):integer;
begin
if (n=1) then
begin
result :=1;
end
else
begin
result:= n*factorial(n-1);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
vir:=StrToInt(n.Text);
res:=StrToInt(x.Text);
repeat
Inc(vir);
result:= exp(res*vir+1)/(vir*(vir*factorial(vir-1)));
until vir > 5;
opera:= round(o + result);
Z.Text:= FloatToStr(opera);
end;
end.
Valora esta pregunta


0