for this excercise follow the cdecl protocol for the specifi

for this excercise follow the cdecl protocol for the specified procedure and write a short console32 test-driver program to test the procedure.

1. write a procedure discr that could be described in C/C++ by

int discr(int a, int b, int c)

//return the discriminant b*b-4*a*c

that is, its name is discr, it has three doubleword integer parameters, and it is a value-returning procedure.

Solution

int discr(int a, int b, int c)

//This function takes 3 parameters named a, b, and c as input parameters and will return the discriminant as an integer.

//the discriminant is formulated as b*b-4*a*c

{

  return b*b - 4*a*c;

}

//And the test drive program is:

int main()

{

int a, b, c;

printf(\"Enter the values for a, b, and c: \");

scanf(\"%d%d%d\", &a, &b, &c);

printf(\"The discriminant is calculated as: %d\ \", discr(a, b, c));

}

for this excercise follow the cdecl protocol for the specified procedure and write a short console32 test-driver program to test the procedure. 1. write a proce

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site