Question: C program problem a: Below is some sample C code. Create the three macros indicated with comments. // Create a macro called RATE with a

C program problem

a:

Below is some sample C code. Create the three macros indicated with comments.

// Create a macro called RATE with a fixed value of 0.12

#define

// Create a macro called SIMPLE_INTEREST that takes in values principal and time

// and computes the amount of interest generated.

// Hint: simple interest is principal times rate times time (in years).

#define

// Create a macro called AMOUNT that takes in values principal and interest and

// computes the final amount after the interest has been added.

// Hint: principal plus interest.

#define

float principal = 1000.0;

int time = 10;

float simple_interest = SIMPLE_INTEREST(principal, time);

float amount = AMOUNT(principal, simple_interest);

b:

Based on the last question, write the code that would appear after the preprocessor has substituted the macros in the code:

float principal = 1000.0;

int time = 10;

float simple_interest =

float amount =

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!