Question

Write a function to compute the product 1×· · ·×n, for positive n. Write a main...

Write a function to compute the product 1×· · ·×n, for positive
n. Write a main function to call it, and illustrate various interesting
memory configurations during its execution.Write a version of product that uses a while
loop instead of recursion.

in c language thank. confuse for a while aready

0 0
Add a comment Improve this question Transcribed image text
Answer #1

void main( int m in ents a pi value mj canthe stetuyn valce C

Add a comment
Know the answer?
Add Answer to:
Write a function to compute the product 1×· · ·×n, for positive n. Write a main...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JavaScript Write a function using recursion to compute the Fibonacci number of n (where n is...

    JavaScript Write a function using recursion to compute the Fibonacci number of n (where n is a positive integer). Your function should output the calculated result for the n given. You also need to type check to make sure the value being given is an integer.

  • Write a python program (recursive.py) that contains a main() function. The main() should test the following...

    Write a python program (recursive.py) that contains a main() function. The main() should test the following functions by calling each one with several different values. Here are the functions: 1) rprint - Recursive Printing: Design a recursive function that accepts an integer argument, n, and prints the numbers 1 up through n. 2) rmult - Recursive Multiplication: Design a recursive function that accepts two arguments into the parameters x and y. The function should return the value of x times...

  • Write a program that will do the following. The main function should ask the user how...

    Write a program that will do the following. The main function should ask the user how many numbers it will read in. It will then create an array of that size. Next, it will call a function that will read in the numbers and fill the array (fillArray). Pass the array that was made in themain function as a parameter to this function. Use a loop that will read numbers from the keyboard and store them in the array. This...

  • C language Write a function to compute the power a^m, where n greaterthanorequalto 0. It should...

    C language Write a function to compute the power a^m, where n greaterthanorequalto 0. It should have the following prototype:/* Sets *p to the n' th power of a and returns 0, except * when n < 0 or p is NULL, in which case it returns -1. */int power(int a, int n, int * p); Write a unit test in a main function to test various values. The following code sequence illustrates how to use printf to provide informative...

  • *********C Language******* Write a file final_main.c 4. Inside main(void): Write a loop that oops until the...

    *********C Language******* Write a file final_main.c 4. Inside main(void): Write a loop that oops until the entered number is 0 or negative 5. Ask the user to enter a positive int between 0 and 10 inclusive 6. If the number is < 1, it terminates. 7. Else: call the above four functions 8. Print the result of each function after its call. Q2. Write a program that removes the punctuations letters from a file and display the output to the...

  • Please solve the program in C++(Recursive) Write a function called factorialIterative(). This function should take a...

    Please solve the program in C++(Recursive) Write a function called factorialIterative(). This function should take a single BIG integer (bigint) as its parameter n, and it will compute the factorial n! of the value and return it as its result (as a bigint). Write this functions using a loop (do not use recursion). 2. Write the factorial function again, but using recursion. Call this function factorialRecursive(). The function takes the same parameters and returns the same result as described in...

  • Write a main function and subfunctions in c language to compute the amount of steel and...

    Write a main function and subfunctions in c language to compute the amount of steel and concrete required for the construction of a series of cooling tanks for a power plant. The dimensions of each tank (length l, width w, and height h are the input to the main program. The wall thickness is tw and the floor thickness is tf. The ratio of steel to concrete is 1:4. A function to compute the amount of steel required to construct...

  • dont use switch E) 120 pts.] Write another function int main ) in C++(and comment the...

    dont use switch E) 120 pts.] Write another function int main ) in C++(and comment the main in Q1.D) that displays the following menu using a do while loop: please choose from the following Menu: I: Populate array with 5 elements 2: Print Array 3: Reverse Array 0: Exit Based, on the user choice, you should call the appropriate function. For example, if the user: - chooses 1, then in function main you should call function populateArray (A, 5); -...

  • MATLAB Write a function called next_prime that takes a scalar positive integer input n. Use a whi...

    MATLAB Write a function called next_prime that takes a scalar positive integer input n. Use a while-loop to find and return k, the smallest prime number that is greater than n. Feel free to use the built-in isprime function (do not use nextprime). MATLAB

  • 1) a) Write MATLAB function that accepts a positive integer parameter n and returns a vector...

    1) a) Write MATLAB function that accepts a positive integer parameter n and returns a vector containing the values of the integral (A) for n= 1,2,3,..., n. The function must use the relation (B) and the value of y(1). Your function must preallocate the array that it returns. Use for loop when writing your code. b) Write MATLAB script that uses your function to calculate the values of the integral (A) using the recurrence relation (B), y(n) for n=1,2,... 19...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT