0
- Make a pseudocode and flowchart that enters with 3 values and generates the 2 degree equation, check the possible roots. Delta= (b*b) -(4*a*c), check whether Delta is greater than 0, less than 0 or equal to 0.
I did it like this, I don’t know if it’s all right.
Inicio_algoritmo
Declare: A, B, C e D numéricos
Escreva: “Digite três valores para verificar se o delta é maior que 0, menor que 0 ou igual a 0”
Leia: A, B, C
D <- ((b*b) -(4*a*c))
Se (D > 0)
Escreva “X1 = “ (-B + RaizQ(D)/ (2*A), “X2 = “ (-B – RaizQ(D)/(2*A)
Senão_se (D == 0)
Escreva “X1 = “ (-B + RaizQ(D)/ (2*A), “X2 = “ (-B – RaizQ(D)(/2*A)
Senão
Escreva “ Não há raízes, delta menor que 0. ”
Fim_algoritmo
The logic is right, as for the syntax of the commands I have my doubts.
– anonimo
One detail: if delta is zero, the square root is also zero and the two roots are equal to
-B / (2*A)
(would not need to calculate the square root, and could do the account only once before writing)– hkotsubo