Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8773663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:21:28+00:00 2026-06-13T18:21:28+00:00

public static int exponent(int baseNum) { int temp = baseNum *= baseNum; return temp

  • 0
public static int exponent(int baseNum) {
    int temp = baseNum *= baseNum;                

        return temp * exponent(baseNum);             
}

Right now the method above does n * n into infinity if I debug it, so it still works but I need this recursive method to stop after 10 times because my instructor requires us to find the exponent given a power of 10.

The method must have only one parameter, here’s some examples of calling exponent:

                System.out.println ("The power of 10 in " + n + " is " + 
                    exponent(n));

So output should be:

The power of 10 in 2 is 1024

OR

The power of 10 in 5 is 9765625
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:21:29+00:00Added an answer on June 13, 2026 at 6:21 pm

    Create an auxiliary method to do the recursion. It should have two arguments: the base and the exponent. Call it with a value of 10 for the exponent and have it recurse with (exponent-1). The base case is exponent == 0, in which case it should return 1. (You can also use exponent == 1 as a base case, in which case it should return the base.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public static int ABC(int x, int y) { if(y==0) return(1); else return(x * ABC(x,y-1));
First code : public static int pitagoras(int a, int b) { return (int) Math.sqrt(a*a
here's the method: public static int chooseStrat () { String[] strats = new String[1]
I have this method: public static int what(String str, char start, char end) {
public static int Test(int n) { if (n < 0) return 1; if (n
ex: public static int fibb (int n) { if(n==0||n==1) return 1; else{ return fibb(n-1)+fibb(n-2);
I have the following method written: public static int hash2(String key, int tableSize) {
class test { static int arr[]={1,6,3,4,5,8,11}; static int s=0,temp=0,e=0; public static void main(String []
I have something like this: class Base { public: static int Lolz() { return
I have this method: public static int SetFlag(this int i, int flag, bool set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.