Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { paulogp }
- Program Peda_06; { Formula resolvente. Inclui numeros complexos! }
- Uses
- WinCrt;
- Var
- A,B,C,Raiz_Delta,Delta,X1i,X2i: Real;
- D,Tecla: Char;
- Begin
- Repeat
- ClrScr;
- WriteLn('Formula resolvente!');
- WriteLn('~~~~~~~~~~~~~~~~~~~');
- WriteLn('Programado por: Paulo G.P.');
- WriteLn;
- WriteLn;
- WriteLn('ax^2 + bx + c = 0');
- WriteLn;
- Write('Introduza o valor "a": ');
- ReadLn(A);
- WriteLn;
- Write('Introduza o valor "b": ');
- ReadLn(B);
- WriteLn;
- Write('Introduza o valor "c": ');
- ReadLn(c);
- WriteLn;
- WriteLn(a:1:1,'x^2 + ',b:1:1,'x + ',c:1:1,' = 0');
- WriteLn;
- Delta:=Sqr(B) - 4 * A * C;
- If Delta<0 then
- Begin
- Raiz_Delta:=Sqrt(-Delta);
- X1i:=(-B)/(2*a);
- X2i:=(-B)/(2*a);
- WriteLn('X1= ',X1i:1:1,' + ',(Raiz_Delta/(2*A)):1:1,' i');
- WriteLn('X2= ',X2i:1:1,' - ',(Raiz_Delta/(2*A)):1:1,' i');
- End else
- Begin
- Raiz_Delta:=Sqrt(Delta);
- X1i:=((-b)+Raiz_Delta)/(2*A);
- X2i:=((-b)-Raiz_Delta)/(2*A);
- WriteLn('X1= ',X1i:1:1);
- WriteLn('X2= ',X2i:1:1);
- End;
- WriteLn;
- WriteLn;
- Write('Repetir o programa (s/n)? ');
- Tecla:=ReadKey;
- Until (Tecla='N') or (Tecla='n');
- DoneWinCrt;
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement