1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Irina-Kira [14]
3 years ago
6

Write a recursive method int power(int i, int j which determines teh result of i^j where j>=0

Computers and Technology
1 answer:
Afina-wow [57]3 years ago
6 0
Int power( int i, int j )
{
   if( j == 0 )  // base case
       return( 0 );
   return( i * power( i, j -1 ) );
}
You might be interested in
Write a structured algorithm that prompts the
MA_775_DIABLO [31]

Answer:

Step 1 : Start

Step2 : Input first number, num1

Step3 : Input second number, num2

Step4 : product - - > num1 * num2 (product of num1 and num2)

Step5 : Input product, myanswer

Step6 : comparison - - - > correct or incorrect based on myanswer and product

Step6: print(comparison)

Step7: End

Explanation:

Algorithm is a sequence of instructions a computer is expected to follow to solve a particular problem.

Required :

Two inputs ; num1 and num2

Expected output

Algorithm :

Step 1 : Start

Step2 : Input first number, num1

Step3 : Input second number, num2

Step4 : product - - > num1 * num2 (product of num1 and num2)

Step5 : Input product, myanswer

Step6 : comparison - - - > correct or incorrect based on myanswer and product

Step6: print(comparison)

Step7: End

The two numbers to multiply are entered ; the product is calculated by the program ; the the user inputs his or her own expecteted product ;

Both are compared and the output of the comparison is displayed (either correct oe incorrect)

8 0
3 years ago
g Write a user-defined MATLAB function for the following math function: y ( x )=(−.2 x 3 +7 x 2 )e −.3x The input to the functio
kolezko [41]

Answer:

Go to explaination for the step by step answer.

Explanation:

a)Code

function[y]=operation(x) % this function takes x as input and returns y as output

y=(-0.2*x^3+7*x^2)*exp(-0.3*x)

end

% call this function in command widow by typing operation(value of x) like shown in figure in the first attachment.

b. write a code of above function in one script window and save the code with same name as name of function that is name of script should be saved as operation.Now copy paste the below code in new script window and run the code

clc

clear all

x=-2:.1:6

n=length(x)

for i=1:1:n

a=x(i)

y(i)=operation(a)

end

plot(y,x)

xlabel('X')

ylabel('Y')

Please kindly check attachment for pictorial answers that supports the code.

4 0
3 years ago
Which tab do you select to change how you see your Word document on screen?
seraphim [82]

Answer:view

Explanation:i just took the test

8 0
3 years ago
Read 2 more answers
Which is an example of an binary number?
Liula [17]
The second one
01111
This is because a computer uses binary and only understands two digits which consit of 1 and 0
8 0
3 years ago
Read 2 more answers
How to script and code a basic flash game.
Step2247 [10]
You can use Java-Script to code any type of game..
3 0
3 years ago
Other questions:
  • What argument for "the seen" suggested that breaking windows is a good thing?
    11·1 answer
  • In a flow chart, both the decision structure and the repetition structure use the diamond symbol to represent the condition that
    9·1 answer
  • What activities are the most likely to infect your computer with a virus? Check all that apply
    11·2 answers
  • Xanadu was to be a full-blown multimedia computer that could embody any medium.a. Trueb. False
    6·1 answer
  • With which feature or menu option of a word processing program can you make an image like this ?
    15·2 answers
  • Be able to list a technology-based company and discuss whether it enjoys sustainable competitive advantage based on the resource
    13·1 answer
  • Verify (valid or not valid) using resolution the following reasoning: "Every student in the SCIS is a CS student or an IT studen
    15·1 answer
  • A common approach of networking multiple computers as opposed to a single computer is? called:
    14·1 answer
  • What is modularity? Help asap
    9·1 answer
  • The<br>tool can lighten the part of an<br>image.*<br>Your answer​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!