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
tino4ka555 [31]
3 years ago
7

1) Create a recursive program that prompts the user for a nonnegative integer N and outputs. a) Sum [N] b) BiPower [N] c) TimesF

ive [N] Describe any input constraints in the opening comment of your recursive methods
Computers and Technology
1 answer:
Georgia [21]3 years ago
4 0

Answer:

//Code is created using java

import java.util.*;

// returns the sum

public int sum(int N)

{

if(N==1)

return (1);

else

return N+sum(N-1);

}

// code to return the Bipower ouput

public int BiPower(int N)

{

if(N==1)

return (2);

else

return 2*BiPower(N-1);

}

// Code to return TimesFive output

public int TimesFive(int N)

{

if(N==1)

return 5;

else

return 5 + timesFive(N-1);

}

public static void main(String args[])

   {

//Prompts the user to enter a nonnegative integer

       int N  = Integer.parseInt.(console.readLine("Enter a nonnegative integer:  "));

//Outputs the sum, Bipower and TimesFive

       System.out.println(sum(n));

       System.out.println(BiPower(n));  

       System.out.println(TimesFive(n));

   }

}

You might be interested in
2. Which pattern microphone should Jennifer take to the press conference? Jennifer is a journalist with one of the leading newsp
Rudiy27

Answer:

dynamic

Explanation:

4 0
3 years ago
What is up with the bots? They are so annoying.
Yuki888 [10]

Answer:

very very very annoying

6 0
3 years ago
Read 2 more answers
Write a brief explanation of the problems that can occur in each of the following scenarios and what you should do to avoid thes
photoshop1234 [79]
1. Horsing around can lead to breaking equipment in the classroom or somebody getting hurt

2. leaving your backpack on the floor can cause someone to fall

3.something unexpected may happen and worsen the problem

4. it can corrupt the computer's files and deleted unsaved work.

if you want the sentences to be longer, add some words to them and make the message the same.
4 0
4 years ago
If Moses receive an email from his friend what is the name of the space where the massage is kept​
kipiarov [429]
Bbb NC d to lc fix B this is not keyboard
3 0
3 years ago
The benefit of host and guest operating system difference is:
Mazyrski [523]
B bc i said sooooooooo
5 0
3 years ago
Read 2 more answers
Other questions:
  • Ideally, how often should you back up the data on your computer? once an hour, once a day, once a month, once a year. Please hur
    5·2 answers
  • Consider the following page reference string:
    12·1 answer
  • Before entering a loop, the first input, or ____, is retrieved.
    14·1 answer
  • What must be done before using ArrayLists?<br><br> (This is Java Programming btw)
    9·1 answer
  • Sometimes when a baby is born they need to be kept in an incubator for a period of time. A manufacturer would like to design a n
    11·1 answer
  • Need help with photography
    12·1 answer
  • Which vulnerability can occur if a programmer does not properly validate user input and allows an attacker to include unintended
    13·1 answer
  • Can anyone give me $2 (Reddem code/Promo Code)​
    15·2 answers
  • Serena, an analyst at an environmental agency, wants to prepare a report using data from the Car Emissions database.
    11·2 answers
  • Can someone help plz, I’d really appreciate it
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!