Modify the C code

83 views 2 pages ~ 321 words
Get a Custom Essay Writer Just For You!

Experts in this subject field are ready to write an original essay following your instructions to the dot!

Hire a Writer

Modify the C code to compute the product of two numbers rather than the sum of two integers. Support your experimentation with a screen capture of the new code being executed.

To update the C code to calculate the product of two integers, replace the addition (+) symbol in the code to multiplication (*) and then build the code. The code was recompiled, and the result was 200 for 10 times 20.

Create a new test table with at least three separate test cases for the product of two integers, specifying input and anticipated output. Include screen photos of all text table values being executed correctly.The test plan below was ran on an online complier (ideon.com). The results are listed below in screen captures.

Run #

Input A

Input B

Expected Output

1

7

14

98

2

19

83

1577

3

-7

14

-98

Change the C code to calculate the quotient (e.g. a/b) of two floats (e.g. 2.3/1.5).Hint: Use float variable types as opposed to integers. What happens if the denominator is 0.0? Support your experimentation with screen captures of executing the new code

For it to be possible to use float for this case, the first step will involve defining the variable within the definitions section, as shown in the screenshot. Once float has been defined, the complier can be returned to output a value for F.

What happens if the denominator is 0.0? Once the code was executed, it retuned the value of “inf” when the denominator was changed to 0.0. The retuned value of “inf” after the code as executed indicated that the compiler error out when trying to divide 2.3 by 0.0. The screen show below clearly presents the execution;

Prepare a new test table with at least 3 distinct test cases listing input and expected output for the quotient of two floats.

The following test plan was executed within the online compiler. The results of the executions are illustrated in the screenshots below;

Run #

Input A

Input B

Expected Output

1

3.4

1.2

2.83333333

2

-2.5

2.0

-1.25

3

2.9

1.5

1.93333333

April 13, 2023
Number of pages

2

Number of words

321

Downloads:

38

Writer #

Rate:

4.7

Verified writer

Richard is the best writer for Data Science tasks, even if you have something really complex. I needed to do tasks on security matters and already had a draft. Sharing my ideas with Richard ended up in a perfect paper!

Hire Writer

This sample could have been used by your fellow student... Get your own unique essay on any topic and submit it by the deadline.

Eliminate the stress of Research and Writing!

Hire one of our experts to create a completely original paper even in 3 hours!

Hire a Pro