Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1: 1. Write a C program that helps you to complete Self-Check Questions 1 in Section 3.2 on Page 123. Hints: a. You need

Part 1: 1. Write a C program that helps you to complete Self-Check Questions 1 in Section 3.2 on Page 123. Hints: a. You need to declare a variable for x, y, z, u, v, w, assign them some initial values, and declare a variable to hold the result of the expressions, add one printf statement to print the value of the result. b. Make sure that you include the declarations of C library functions.

2. Write a C program to complete Programming Exercise Question 3 in Section 3.4 on Page 136. Hints: You need to write a function named print_instruction(), place its prototype before main() and its definition after main(). Then inside main(), call this function after variable declaration. NOTE: The questions in Part 1 are NOT required to submit.

Part 2: 1. Complete the MODIFIED programming project 1 in Page 167. Implementation requirements: a. You MUST write a function that calculates the monthly payment based on the principal, monthly interest rate, and total number of payments.

b. You must get the principal, monthly interest rate, and total number of payments from user inside main(), then pass these values to this function in a. above, then print the computed monthly payment inside main().

c. You dont get user input inside this function in a. above. Hints: The function in a. above is a function with multiple input arguments and one return result. It is like the function scale() in Figure 3.23 on Page 142. Your main() function is like the main() in Figure 3.24 on Page 143. Your entire program is like the entire program in Figure 3.24 on Page 143.

image text in transcribed

THE QUESTIONS ARE FROM THE PROBLEM SOLVING AND PROGRAM DESIGN IN C

3 runctions with Input Arguments 143 FIGURE 3.24 Testing Function scale 2Tests function scale. /* printf, scanf definitions / /* pow definition */ 4include 15. #include 7./ Function prototype */ 8. double scale(double x, int n)i 9. 10. int 1 main(void) 13 14 double num_1: int num_2 /* Get values for num_1 and num_2 */ printf("Enter a real number> "): scanf("%lf", &num1 ) ; printf( "Enter an integer> ")i scanf ( "%d" , &num2); 17 18. an - the / call scale and display result. / printf( "Result of call to function scale is 8fln, scale (num 1, num_2)): actual arguments return (0); 27 double 31, scale(double x, int n) formal parameters /* local variable 10 to power n */ double scale_factori scalefactor = pow (10, n); return (x scale_factor) - Enter a real number> 2.5 Enter an integer>2 Result of call to function scale is 0.025

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

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions