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 47356 Registration date Monday February 1, 2010 Status Moderator Last seen February 15, 2023 - 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');
Read(A)
Write('Input B')
Read(B)
Write('Input C')
Read(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
Thanks in advance

1 response

Ambucias Posts 47356 Registration date Monday February 1, 2010 Status Moderator Last seen February 15, 2023 11,172
Jan 14, 2018 at 07:34 AM
CCM will not help you. CCM does not provide help for homework. You must earn your own grades.
0