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
OLEGan [10]
3 years ago
6

Implement a recursive method named power that takes 2 integer parameters named base and expo. The method will return the base ra

ised to the power of expo.
Computers and Technology
1 answer:
nika2105 [10]3 years ago
3 0

Answer:

def power(base, expo):

   if expo == 0:

       return 1

   else:

       return base * power(base, expo-1)

Explanation:

*The code is in Python.

Create a method called power that takes base and expo as parameters

Check if the expo is equal to 0. If it is return 1 (This is our base case for the method, where it stops. This way our method will call itself "expo" times). If expo is not 0, return base * power(base, expo-1). (Call the method itself, decrease the expo by 1 in each call and multiply the base)

You might be interested in
Select the correct answer from each drop-down menu.
Gelneren [198K]

Answer:

Maybe computer engineering and marketing skills

4 0
3 years ago
Please help!! I need this asap! thank you so much!! <3
ValentinkaMS [17]
I think it’s the last one
6 0
3 years ago
Business cards are generally designed so that this item stands out the most.
Sloan [31]
The D. Company Name most likely stands out on a business card with an address or such in smaller font below. A logo does nothing for a business card if a potential customer doesn't even know the name of the business. While logo's are often present on a business card, the company name is far more crucial to enunciate clearly which is of course, important for business's attraction of new customers.

So D. Company Name is my final answer!

Hope this helps! ;)
3 0
3 years ago
What is the name used for the camera s view from a single position?
CaHeK987 [17]
The answer to your question is a shot


6 0
3 years ago
Write a C program that creates two threads to run the Fibonacci and the Runner processes. Threads will indicate the start and th
OleMash [197]

Answer:

see explaination

Explanation:

#include <pthread.h>

#include <stdio.h>

int sumOfN = 0;

int arr[1000];

int n;

void * findSumOfN(void *a){

printf("Thread 1 Starting\n");

sumOfN = (n * (n+1)) / 2; //finds sum of first n natural numbers

printf("Thread 1 Finished\n");

pthread_exit(0);

}

void * fibonacci(void *a){

printf("Thread 2 Starting\n");

arr[0]=0;

arr[1]=1;

for(int i=2;i<n;i++) //find fibonacci numbers iteratively

arr[i]=arr[i-1]+arr[i-2];

printf("Thread 2 Finished\n");

pthread_exit(0);

}

int main(void){

printf("Please enter the value of n \n");

scanf("%d", &n);

if (n <= 0)

{

printf("Wrong input ! \n"); //input validation

return 0;

}

pthread_t thread1, thread2;

pthread_create(&thread1,NULL, findSumOfN, NULL); //Create threads

pthread_create(&thread2,NULL, fibonacci, NULL);

pthread_join(thread1,NULL); //Start threads

pthread_join(thread2, NULL);

printf("The sum of first %d numbers is : %d \n",n, sumOfN);

printf("The first %d fibonacci numbers are : \n",n);

for (int i = 0; i < n; ++i)

{

printf("%d ", arr[i]);

}

printf("\n");

return(0);

}

3 0
3 years ago
Other questions:
  • What is the difference between a learner’s license and an operator’s license?
    13·1 answer
  • A high-angle shot is the same thing as a bird’s-eye shot. True False
    11·2 answers
  • What is output by the following C# code segment?int temp;temp = 180;while ( temp != 80 ) {if ( temp &gt; 90 ) {Console.Write( "T
    7·1 answer
  • Which function of a word processing program enables you to apply a preset formatting
    5·1 answer
  • What is TCP/IP adress​
    10·1 answer
  • To check if your operating system is up to date, click Start then click Control Panel and choose _______________. Select one: a.
    11·1 answer
  • What is the disadvantage of server based network?
    7·2 answers
  • Interest on loan paid to sangam stores Rs5000(journal entry)​
    13·1 answer
  • How would you describe binary to someone ??<br> PLEASE ANSWER I WILL GIVE U BRAINLY!!
    15·2 answers
  • I really need help in this!!!
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!