Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The function calculate_addition() takes 2 parameters type of double and returns the result the addition of the 2 arguments. However, the code produces the wrong

image text in transcribed

The function calculate_addition() takes 2 parameters type of double and returns the result the addition of the 2 arguments. However, the code produces the wrong output when executed as shown in the figure below. Rewrite the single line of code that will fix this bug main.c. 1 #include 2 3 double calculate_addition(double p1, double p2); 4- int main() { 5 6 7 double add; 8 add calculate_addition(52.1, 23.4); 9 printf("p1 + p2 = %.21f ", add); 10 11 return 0; 12} 13 14- double calculate_addition(double p1, double p2){ 15 16 y = pi + p2; 17 return; 18 } 19 double y; input main.c:17:5: warning: 'return' with no value, in function returning non-void rain.c:14:8: note: declared here pi + p2 = 75.50

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions