Ask Question
9 October, 12:54

wo non-negative integers x and y are equal if either: Both are 0, or x-1 and y-1 are equal Write a function named equals that recursively determines whether two parameters (both containing integer values) are equal and returns True or False.

+5
Answers (1)
  1. 9 October, 15:49
    0
    Using python programming language.

    Explanation:

    #to define the function write as below

    def equal ():

    #to get the two integers from the user

    #The user is asked for input in the code below.

    x = int (input ("Enter the value for X"))

    y = int (input ("Enter the value for y"))

    if x==0 and y==0:

    print ("both numbers are ", "0")

    elif: x==1 and y==1: #This test if both x and y are 1

    print ("true")

    elif: x==y: #this line test if both values are equal

    print ("true")

    else:

    print ("False")

    equal () #end of the function
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “wo non-negative integers x and y are equal if either: Both are 0, or x-1 and y-1 are equal Write a function named equals that recursively ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers