Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program fkwd1;
- USES CRT,GRAPH;
- Var
- a,b,c,d,e,f,g,delta:real;
- //***********************************************************DELTA
- function delta1(a,b,c:real):real;
- BEGIN
- delta1:=((b*b)-(4*(a)*(c)));
- END;
- //***********************************************************DELTA
- //***********************************************************X1
- function x1(a,b,c:real):real;
- BEGIN
- x1:=(-b-sqrt(delta)/2*(a));
- END;
- //***********************************************************X1
- //***********************************************************X2
- function x2(a,b,c:real):real;
- BEGIN
- x2:=(-b+sqrt(delta)/2*a);
- END;
- //***********************************************************X2
- //***********************************************************x0
- function x0(a,b:real):real;
- BEGIN
- x0:=(-b/2*a);
- END;
- //***********************************************************X0
- BEGIN
- clrscr;
- writeln('*********************************************');
- WRITELN('* Program do obliczania FUNKCJI KWADRATOWEJ *');
- writeln('*********************************************');
- writeln('');
- writeln('');
- WRITELN('Podaj dane wejsciowe. Podaj "a"');
- REPEAT
- textcolor(red);WRITELN('A MUSI byc ROZNE od zera!');textcolor(white);
- READ(a);
- UNTIL a<>0;
- WRITELN('Podaj "b"');
- READ(b);
- WRITELN('Podaj "c"');
- READ(c);
- BEGIN
- d:=delta1(b,a,c);
- WRITELN('DELTA WYNOSI: ');textcolor(green); write(d:2:2); textcolor(white); writeln('');
- //------------------------------------------------------------
- IF d>0 THEN // JEZELI d>0 program poda x1 i x2
- begin
- e:=x1(b,d,a);
- f:=x2(b,d,a);
- Writeln('X1 wynosi: ',e:2:2);
- Writeln('x2 wynosi: ',f:2:2);
- END;
- //------------------------------------------------------------
- IF d=0 THEN // JEZELI d=0 program poda x0
- BEGIN
- g:=x0(b,a);
- writeln('Xo wynosi: ',g:2:2);
- END;
- //------------------------------------------------------------
- IF d<0 THEN
- BEGIN
- writeln('!!! NIE MA ROZWIAZAN !!!');
- END;
- END;
- readln;
- END.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement