Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
505 kaklik 1
program zamena;
2
uses crt;
3
 
4
var x,y : integer;
5
 
6
procedure swap(var x,y : integer);
7
 
8
var buf, buf2: integer;
9
 
10
begin
11
 
12
 
13
  buf:=x;
14
  x:=y;
15
  y:=buf;
16
 
17
end;
18
 
19
function mocnina(R:double; E : integer ): double;
20
 
21
var i : integer;
22
var nasobek : double;
23
 
24
begin
25
 
26
  if E > 0 then
27
  begin
28
 
29
  nasobek:=1;
30
 
31
     for i:=1 to E do
32
     begin
33
 
34
       nasobek:=R*nasobek;
35
     end;
36
 
37
     mocnina:=nasobek;
38
 
39
  end;
40
 
41
  if E < 0 then
42
  begin
43
 
44
  nasobek:=1;
45
 
46
     for i:=1 to abs(E) do
47
     begin
48
 
49
       nasobek:=(1/R)*nasobek;
50
     end;
51
 
52
     mocnina:=nasobek;
53
 
54
  end;
55
 
56
  if E=0 then mocnina:=1;
57
 
58
end;
59
 
60
 
61
procedure kruh(): double
62
 
63
var x,y: integer;
64
 
65
 
66
begin
67
 
68
  for 0 to 1000000 do
69
  begin
70
 
71
    x:=random(0,1000);
72
    y:=random(0,1000);
73
 
74
    if sqrt(x pow(2) + y pow(2)) <= 1000; then n:= n+1;
75
 
76
    kruh
77
 
78
  end
79
 
80
 
81
end;
82
 
83
 
84
begin
85
 
86
  clrscr;
87
 
88
  randomized;
89
 
90
  x:=1;
91
  y:=2;
92
 
93
 
94
  write('zadejte hodnoty zaklad, exponent');
95
  readln(x);
96
  readln(y);
97
 
98
 
99
  write('x na y je:', mocnina(x,y));
100
 
101
  readln;
102
 
103
 
104
  swap(x,y);
105
 
106
 
107
 
108
 
109
end.