Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
505 kaklik 1
program druhy;
2
 
3
{$N+}
4
 
5
uses crt;
6
 
7
var
8
   a,b,c  : integer;
9
   koren1,koren2 : double;
10
 
11
type
12
   koreny = record
13
       x1 : double;
14
       x2 : double;
15
   end;
16
 
17
 
18
procedure vyres(a,b,c: integer; var x1,x2 : double);
19
var
20
 
21
   diskr : double;
22
 
23
begin
24
 
25
   diskr:= b*b -4 * a * c;
26
 
27
   if (diskr < 0) then
28
   begin
29
      writeln ('Rovnice nema realne reseni');
30
      exit;
31
   end;
32
 
33
   if(diskr = 0) then
34
   begin
35
      x1:= -b/2*a;
36
      writeln('rovnice ma jeden koren : ', x1)
37
   end
38
 
39
   else begin
40
        x1:= (-b+sqrt(diskr))/2;
41
        x2:= (-b-sqrt(diskr))/2;
42
        writeln('Rovnice ma dva koreny ',x1,' ',x2)
43
   end;
44
 
45
end;
46
 
47
begin
48
 
49
   clrscr;
50
 
51
   writeln ('zadejte tri koreny rovnice:');
52
   readln(a);
53
   readln(b);
54
   readln(c);
55
 
56
 
57
 
58
   vyres(a,b,c, koren1, koren2);
59
 
60
   readln;
61
 
62
end.