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
Hitman42 [59]
3 years ago
15

Recursive Power Function Write a function that uses recursion to raise a number to a power. The function should accept two argum

ents: the number to be raised and the exponent. Assume that the exponent is a nonnegative integer. Demonstrate the function in a program.
Computers and Technology
1 answer:
Firlakuza [10]3 years ago
4 0

Answer:

// here is code in c++.

#include <bits/stdc++.h>

using namespace std;

// recursive function to calculate power of number

int cal_pow( int b_num, int e_num )

{

  if ( e_num > 1 )

      return b_num * cal_pow( b_num, e_num - 1 );

  else

      return b_num;

}

int main()

{

   // variables to store inputs

  int b_num, e_num;

  cout <<"Enter the base (int): ";

  //read the base

  cin >> b_num;

  cout << "Enter the exponent (int): ";

  // read the exponent

  cin >> e_num;

// call the function and print the output.

  cout << b_num << " to the " << e_num << " power is: "

      << cal_pow( b_num, e_num ) << endl;

  return 0;

}

//

Explanation:

Read value of base and exponent from user. Call the function cal_pow() with parameter base and exponent. In this function, it will call itself and multiply base value while exponent becomes 1.When exponent becomes 1 then base value will be return by the recursive function. In the last recursive call it will give the base to power exponent

Output:

Enter the base (int): 3                                                                                                    

Enter the exponent (int): 5                                                                                                

3 to the 5 power is: 243

You might be interested in
Which osi layer defines the functions of logical network-wide addressing and routing?
IRISSAK [1]
Answer: The Network Layer
5 0
4 years ago
A malware which acts like a spy in computer system is called ___?​
Leona [35]

Answer:

A Trojan horse, or Trojan

6 0
3 years ago
Read 2 more answers
Which of the following occurs during data cleansing?
Diano4ka-milaya [45]

Answer:c)Clean redundant customer data

Explanation:Data cleansing/cleaning is the activity for the elimination of the data which is not required for further use, corrupt, unnecessary etc by detecting it. The data that is being cleared is categorized by levels like irrelevant  data, incorrect data, inaccurate data, redundant data etc.

The data is eliminated by the method of correcting , modifying, reducing unnecessary parts,deleting, etc.Thus, the correct option is option(C).

5 0
4 years ago
Which of the following characters is acceptable to use in a filename
Rama09 [41]
You never stated the possible answer choices to your answer, but usually in a filename you can use all letters of the alphabet, but you cannot use any symbols. such as backslashes, percentage signs etc., but underscores you can use, since they can be used for spacing 2 seperate words.
4 0
3 years ago
Read 2 more answers
Match each word to its correct meaning.
monitta

Answer:

1. Graphics.

2. Clip art.

Explanation:

1. Graphics: visual representations of information that are not text-images, photos, symbols, diagrams, and so on. Some examples of software applications used for graphics design are CorelDraw, Adobe Illustrator, Affinity Designer, Inkscape, Adobe Photoshop, etc.

Adobe Photoshop is a proprietary software application designed and developed by Adobe inc. for both Windows and MacOS operating system. It is a raster graphics editor that's typically used for imaging and graphics design. It comprises of various shape tools such as ellipse, line, polygon, triangle, custom shape and rectangle.

2. Clip art: digital artwork such as symbols and pictures that can be imported for use in documents or other software applications.

7 0
3 years ago
Other questions:
  • Cissy looks up a number in the phone book, pushes the book away, and then dials the number. why does she discourage any interrup
    8·2 answers
  • Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the ga
    12·2 answers
  • John Cleaver is the CEO of Tech World, which is a retail store that sells computers, monitors, cameras, televisions and many oth
    6·1 answer
  • Cameron is having a party and needs to write step-by-step directions on the invitation. Which type of list would you
    11·1 answer
  • Why is statistics important for business professionals in many career fields?
    13·2 answers
  • I love the brainly update guys! :)
    5·2 answers
  • Any Danganronpa fans around here? I'm bored.
    13·2 answers
  • Select the correct answer from each drop-down menu.
    5·2 answers
  • 11. FROM WHICH MENU WOULD YOU BE ABLE TO FIND COLUMNS? *
    11·1 answer
  • Discuss any 4 differences between first and second generation of programming languages <br>​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!