Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me with this code using programming in c. Below is an incomplete code to help you get started: And here are the instructions:

Please help me with this code using programming in c.
Below is an incomplete code to help you get started:
image text in transcribed
And here are the instructions:
image text in transcribed
image text in transcribed
//Add name, date, and description here //preprocessor directives #define CRT SECURE NO WARNINGS #include //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 23 //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 12+ 3. void Calculations (int num, double *productPtr, int *sumPtr); int main() //declare 2 integer variables (num, sum) //declare one double variable (product) //use the function GetIntPointer to get a number from the user //print the number onto the screen //Use the function Calculations to make the calculations for sum and product //print the sum and product onto the screen return 0 //function definitions COP2220 Spring 2019 small program (prog6.c) Please do only one step at a time and do not move onto the next step until you have compiled and tested the current step 1. Read the assignment instructions 2. Create an empty project 3. Add the source code file and name the file: lastname firstname progb.c Copy and paste the prog6.c template 4. Change the header comment so that it has your name, date, and a description of the program wbuild run and test, the outline code should compile and execute 5. The first function you will implement will be the Get IntPointer function . Create the function definition (block of code)below the main function Inside this function ask the user for an integer Scanf the integer into numPtr ***build run and test 6. Now it is time to test the GetIntPointer function with a function call 7. Write the statement to call the GetIntPointer function from inside the main function and pass the "address of num to the function Print num onto the screen from the main function to see the number 8. *build run and test 9. The next function we will implement is the product part of the Calculations function Create the function definition below the main function Inside this function you will need to initialize the value at" productPtr and the value at" sumPtr . Create the while loop and do the product calculation Print the result onto the screen after the loop *build run and test 10. Call the Calculations function from the main function pass the num, "address of" product, and "address of" sum print the product and sum in the main function below the function call The product should be calculated and the sum should be 0. e **build run and test 11. The next we will add the sum part of the Calculations function Create the for loop and do the sum calculation Print the result onto the screen after the loop build run and test BEFORE SUBMITTING THE CODE Intro to Programming in C- small program (prog6) 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. Submit source code (lastname firatname progb.c) through Canvas .One source code file (unformatted text) will be submitted Name the source code file: lastname firstname prog6. The file name must match the assignment The code should be tested and run on a Microsoft compiler before it is uploaded onto Canvas The code must be submitted on time in order to receive credit (11:59 PM on the due date) Late submissions will not be accepted or graded .All programming assigaments are individual work, sharing code is considered cheating 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) /lask, 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 123. //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 23 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" sunPtr before making the calculations

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

Question

=+ What typical employee will the IA compare him/

Answered: 1 week ago

Question

=+7 What is the overall cost of the international assignment?

Answered: 1 week ago