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
Nezavi [6.7K]
4 years ago
9

Two non-negative integers x and y are equal if either: Both are 0, or x-1 and y-1 are equal Write a boolean-method named equals

that recursively determines whether its two int parameters are equal and returns true if they are and false otherwise.
Computers and Technology
1 answer:
crimeas [40]4 years ago
3 0

Answer:

Following are the code which is mention below.

bool equals (int x, int y)  // method equals

{

if( (x<0) || (y<0) )  // check number if it is less then 0

return false;  // return false

if( (x==0) && (y==0) )  // check condition if number is equal to 0

return true;  // return true

return equals(x-1, y-1);  

}

Explanation:

  • Here we declared a function "equals" of type bool which means it either return "true" or "false".
  • Inside the function equals we check the condition which are mention above

                   1.   if x and y both are less then  0 then it returns "false".

                   2.  if x and y both are equal to 0 then it returns "true"

                   3.   Otherwise it return x-1 and y-1.

You might be interested in
Programming: Write a recursive function to_number that forms the integer sum of all digit characters in a string. For example, t
scZoUnD [109]

yes

Explanation:

isn't really noted but if the sequence is in the given order the ("3at4") could be expressed in a ('0' to '9' )format

7 0
3 years ago
WILL UPVOTE ALL.
scoundrel [369]
Ummmmm....... i would say true, hope that helped, if not im super sorry :)
7 0
3 years ago
These are questions from my Computer/Customer Support Class
vladimir2022 [97]
Hey

1. Workers 

2. im not sure about this on

3. The

Hoped I Helped
5 0
3 years ago
The Internet began when a large company wanted to sell products online
aalyn [17]
No!The internet began in the 1950s when the US government was trying to use connected computers to compete with the Soviet Union's Sputnik. Hope this helps :)
6 0
3 years ago
The purpose of a business report is to _____.
mars1129 [50]
Im pretty sure the answer is 2.
4 0
3 years ago
Read 2 more answers
Other questions:
  • A _____ utilizes standard business software, such as Microsoft Word or Microsoft Excel, which has been configured in a specific
    11·1 answer
  • Given a double variable named areaofsquare write the necessary code to read in a value , the area of some square, into areaofsqu
    9·1 answer
  • In order to "print" the data in an object, the class should override the _____ method.
    9·1 answer
  • Who wants to join my zoom after school 23456+4567
    15·1 answer
  • What are the similarities between data mining and data analytics
    11·1 answer
  • When considering changing the content of a cell which button should you press to leave the cell as it originally was
    12·2 answers
  • When connecting past and present issues, it is best to follow a series of steps. Which step is missing from the pattern? 1. Iden
    13·1 answer
  • All of these (except the ______) go unnoticed by the computer
    7·1 answer
  • Name the tools in plant propagation.<br>Q<br>18.<br>16.<br>17.<br>19.<br>20.<br>please po asap​
    15·1 answer
  • Which of these are the two main components of a CPU?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!