Question

Write a pseudocode that has function power which takes two integer numbers as input and return...

Write a pseudocode that has function power which takes two integer numbers as input and return an integer number according to the following:

          Power (2 , 3) = 8

0 0
Add a comment Improve this question Transcribed image text
Answer #1
pseudocode Power:
--------------------
Power(n, m)
    if(m == 0)
        return 1
    else
        result = 1
        for i from 1 to m
            result=result*i
        end for
        return result
    end if
end Power
Add a comment
Know the answer?
Add Answer to:
Write a pseudocode that has function power which takes two integer numbers as input and return...
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
  • Write a function with two input parameters: an array of numbers and the size of the...

    Write a function with two input parameters: an array of numbers and the size of the array (the number of elements). The function should return the count of even numbers in the array. For example, if the input to the function is the array [3, 2, 45, 56, 12], the function would return the integer 3. Use the following function header: int countEvens(int nums[], int size) { }

  • Write the definition of a function that takes as input the three numbers. The function returns...

    Write the definition of a function that takes as input the three numbers. The function returns turn if the first number to the power of the second number equals the third number otherwise it returns false. Assume that the three numbers are of type double. Use paw() function for the power.

  • Write a function that takes as an input parameter an integer that will represent the length...

    Write a function that takes as an input parameter an integer that will represent the length of the array and a second integer that represents the range of numbers the random number should generate (in other words, if the number is 50, the random number generator should generate numbers between 0 and 49 including 49. The function then sorts the list by traversing the list, locating the smallest number, and printing out that smallest number, then replacing that number in...

  • python Write a function that takes as input a single integer parametern and computes the nth...

    python Write a function that takes as input a single integer parametern and computes the nth Fibonacci Sequence number The Fibonacci sequence first two terms are 1 and 1(so, if n - 2 your function should return 1). From there, the previous two values are summed to come up with the next result in the sequence 1.1,2,3,5,8,13, 21, 34, 55, etc.) For example, if the input is 7 then your function should return 13 26561.1615880 1 def Fibonacci(n): # your...

  • Write c++ recursive function 3. A function that takes an integer, and returns the product of...

    Write c++ recursive function 3. A function that takes an integer, and returns the product of the digits, so the input 1989 would return 1∗9∗8∗9 = 648 4. A function that does the above repeatedly, taking a number and computing the product of it’s digits until you get a single digit number: so on input 1989 it would go 1989→648→192→18→8 and return 8. (Note, you can use the previous functions if you want.

  • Using the programming language Java or C++, Write a function that takes an integer as input....

    Using the programming language Java or C++, Write a function that takes an integer as input. Return true if this integer is a palindrome integer; false otherwise;

  • Question is two parts In R(Programming language). Define and write a function which takes one number...

    Question is two parts In R(Programming language). Define and write a function which takes one number as input and detects whether the number is even. Return TRUE if it is even, and FALSE otherwise. You need to first detect if the input is an integer; if not, return NA. Note 1: TRUE and FALSE are logical values, not strings! Note 2: No need to get user input from the console. Test your function using your_function_name(1), your_function_name(2), and your_function_name(1.5). Hint: What...

  • C++ 2. (a) Write a function, printdixisors, that takes a single integer parameter and prints all...

    C++ 2. (a) Write a function, printdixisors, that takes a single integer parameter and prints all the numbers less that the parameter that are divisors of the parameter (i.e. divides it without a remainder) including 1. So printdivisors(6) will print 1,2,3. Note you may use a wrapper function or default parameters. (b) Write a function, sumdixisors, that takes a single integer parameter and returns the sum of all the divisors of the parameter (including 1). So sumdivisors(6) will return 6...

  • Write a C++ program that contains a function called swapNums. This function takes two integer parameters,...

    Write a C++ program that contains a function called swapNums. This function takes two integer parameters, swaps them in memory, and outputs the results (there is nothing to return). In main, ask the user to enter two different numbers, output them as entered (step 1), call the function swapNums() which will output the numbers swapped (step 2), and then output the values again in main (step 3). You should have three sets of output. Sample run (10 and 5 were...

  • Write the following function in Java: A function "makeMangler", that takes as input a list M...

    Write the following function in Java: A function "makeMangler", that takes as input a list M of three numbers. It then builds and returns a "Mangler" function based on M. The "Mangler" function that is produced (by your function makeMangler) would have the property that it takes as input a list, and returns the "mangled" version of that list. "Mangling" a list means doing the following sequence of operations to each item in a list: (1) multiply by the first...

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