Question: Intro to Programming in C Assignment purpose: To compile, build, and execute an interactive program using loops and user defined functions with pass by reference

Intro to Programming in C

Assignment purpose: To compile, build, and execute an interactive program using loops and user defined functions with pass by reference and pass by copy arguments.

Get a number from the user and use that number for loops and to make some calculations. Get a number from the user (n) (For example if the user enters a 3, each loop below will repeat 3 times)

//ask, get, and return an integer (by reference) 
void GetIntPointer(int *numPtr); //input: the number entered by the user (pass by copy) 

//Calculates the product of the first (n)numbers using a while loop and store the result in *productPtr //For example, if the user entered a 3, you would calculate 1 * 2 * 3.

//Calculate the sum of the first (n)numbers using a for loop and store the result in *sumPtr. //For example, if the user entered a 3, you would calculate 1 + 2 + 3.

void Calculations(int num, double *productPtr, int *sumPtr); 

NOTE: You will be graded on correct use of functions and correct loop. Remember to initialize the value at productPtr and value at sumPtr before making the calculations.

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!