# Algo exrcise, URGENT...

Closed
karimakamboua
Posts
12
Registration date
Sunday February 7, 2016
Status
Member
Last seen
January 13, 2018
- Jan 13, 2018 at 08:04 PM
Ambucias
Posts
47363
Registration date
Monday February 1, 2010
Status
Moderator
Last seen
September 1, 2021
- Jan 14, 2018 at 07:34 AM
Hello, I hope u are well ...
If possible, is this treatment of Algo correct!! here is the excercise...

Write a function that recieves 3 parameters(A, B and C) and calculates the discriminant DELTA of trinomial of second degree AX2 + BX + C and which, according to its sign, calculates the real roots of the trinomial , and if necessary displays that there is no real root. The three coefficients A, B and C will be keyed in by the user(in main programme).

Correction

FUNCTION CALC_DELTA(A :ENTIER ,B :ENTIER ,C :ENTIER) :ENTIER
VARIABLES: D, X1, X2: INTEGER
D<-B*B-4*A*C;
RETURN DEL
END FUNCTION
Write('Input A');
Write('Input B')
Write('Input C')
Write( "the discriminant is:")
If D <0 then
Show "Delta is negative, trinome has no real roots"
Else
If dD = 0 then
Write ( "the trinoma has a root";x=takes the value -b / 2a)
If D> 0 then
Write "the trinoma has two distinct roots: x1 = -B-racined) / 2A and x2 = -b + racined / 2a
End