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

Complete the following Programming Assignment using Recursion. Use good programming style and all the concepts previously covere

d. Submit the .java files electronically through Canvas by the above due date (In a zip file). This also includes: Requirements (for this problem), Pseudo-Code, UML, Java Doc(s) and an explanation, etc., which must be in the correct format. 9. Ackermann's Function Ackermann's function is a recursive mathematical algorithm that can be used to test how well a computer performs recursion. Write a method ackermann(m, n), which solves Ackermann's function. Use the following logic in your method: If m=0 then return n +1 If n = 0 then return ackermann (m - 1, 1) Otherwise, return ackermann (m - 1, ackermann(m, n - 1)) Test your method in a program that displays the return values of the following method calls: ackermann(0, 0) ackermann (0, 1) ackermann(1, 1) ackermann(1, 2) ackermann(1, 3) ackermann(2, 2) ackermann(3, 2)
Computers and Technology
1 answer:
Likurg_2 [28]3 years ago
6 0

Answer:

Explanation:

public class Ackermann {

   public static int ackermann's(int m, int n) {

       if (m == 0) {

           return n + 1;

       } else if (n == 0) {

           return ackermann's(m-1, 1);

       } else {

           return ackermann(m - 1, ackermann(m, n - 1));

       }

   }

   public static void main(String[] args) {

       System.out.println(ackermann(0, 0));

       System.out.println(ackermann(0, 1));

       System.out.println(ackermann(1, 1));

       System.out.println(ackermann(1, 2));

       System.out.println(ackermann(1, 3));

       System.out.println(ackermann(2, 2));

       System.out.println(ackermann(3, 2));

   }

}

1

2

3

4

5

6

7

29

Process finished with exit code 0

You might be interested in
Need the answer ASAP !!!!
Nuetrik [128]

Answer:

periodic checks

Explanation:

6 0
2 years ago
((11111111-1011100) X (10100 / 10))- ( 110010000+ 1110011)
dsp73

Answer:

10089891099

Explanation:

?

3 0
3 years ago
Write a function that receives two numbers, m and n and calculates and displays the sum of the integers from m to n. For example
Evgesh-ka [11]

Answer:

The program to this question as follows:

Program:

//header file

#include <stdio.h> //defining header file

void inc(int m,int n) //defining method inc

{

   int sum, i; //declaring variable

   sum=m; //holding value of m variable

   for(i=++m;i<=n;i++) //loop for calculate number between given range  

   {

   sum=sum+i; //adding value

   }

   printf("sum of the integer is : %d",sum);//print value

}

int main() //defining method

{

   int m,n; //defining integer variable

   printf("Enter m value: "); //message

   scanf("%d",&m); //input value by user in variable

   printf("Enter n value: "); //message

   scanf("%d",&n);//input value by user in variable

   inc(m,n); //calling method

   return 0;

}

Output:

Enter m value: 3

Enter n value: 7

sum of the integer is :25

Explanation:

In the above code, an "inc" function is declared, that accepts integer parameters that are "m and n", inside the method two integer variable "sum and i" is declared, which is used in the loop.

  • The loop uses the user parameter to count value and uses the sum variable to calculate there sum.
  • In the main method, two integer variable n and m are declared, which take value from the user end, and at the last, we call the inc method, that prints sum value.
7 0
2 years ago
A spreadsheet program of a computerized version of _______
Romashka-Z-Leto [24]

the answer is "Paper-based Accounting"

8 0
3 years ago
Why do we allow electronic instruments to warm up before use?
son4ous [18]
Is not really a warm up!

we wait for the computer (electronic instrument) to load or process all the data in order to operate properly as its supposed to!
3 0
3 years ago
Other questions:
  • Lewis is using a stylus with his touch screen computer in order to draw a
    8·1 answer
  • How many possible keys does the playfair cipher have? an approximate power of 2
    14·1 answer
  • Where does a computer store it’s information
    11·1 answer
  • Your sister asks you if it is possible to get an office productivity suite for free. What do you tell her?
    13·1 answer
  • Intel Centrino Technology is the combinatin of wirelesstechnology with the previous HT technology.
    14·1 answer
  • How to unsubscribe from Brainly
    6·2 answers
  • While you are working on your computer, it shuts down unexpectedly, and you detect a burning smell. When you remove the case cov
    10·1 answer
  • Which conditions make using an array a better choice than a list? Select 3 options.
    12·2 answers
  • When did time begin?
    11·1 answer
  • ANSWER QUICKLY!!! <br><br> Which aspect of planning is a preventive action?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!