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
alexira [117]
3 years ago
15

Write a recursive function that takes a non-negative integer as an argument and displays the same number in reverse order (i.e.

in order from right to left). For example, if the argument is 76538, it would display 83567.
Computers and Technology
1 answer:
avanturin [10]3 years ago
5 0

Answer:

Following are the program in C++ language

#include<iostream> // header file

using namespace std; // namespace std

int reverse(int n1); // function prototype

int main()  // main function()

{

   int num; // Variable declaration

   cout << "Enter the number" << endl;

   cin >> num; // Read the number bu the user

  cout<<"After Reverse the digit:\n";

   int res= reverse(num); // calling function reverse

   

   cout<<res; // display  

}

int reverse(int n1) // function definition of reverse

{

   if (n1<10)  // checking the base condition

       {

           return n1;

       }

   else

       {

           cout << n1 % 10; // Printed the last digit

          return reverse(n1/10); // calling itsself

}

}

Output:

Enter the number:

76538

After Reverse the digit:

83567

Explanation:

Following are the description of the program

  • In the main function read the number by user in the "num" variable of int type.
  • Calling the reverse and pass that "num" variable into it.
  • After calling the control moves to the body of the reverse function.In this function we check the two condition

        1  base condition

   if (n1<10)  // checking the base condition

       {

           return n1;

     }

      2  General condition

  else

       {

           cout << n1 % 10; // Printed the last digit

          return reverse(n1/10); // calling itsself

       }

  • Finally return the reverse number and display them into the main function.
You might be interested in
Used prevalently on the web, it allows for secure messages to be sent between parties without having to agree on, or share, a se
Sati [7]

Answer: A- Public Key Encryption

Explanation: The Public key Encryption is used prevalently on the web, it allows for secure messages to be sent between parties without having to agree on, or share, a secret key. It uses an asymmetric encryption scheme in which the encryption key is made public, but the decryption key is kept private.

7 0
3 years ago
Read 2 more answers
What does www stand for?
Temka [501]
Www stands for world wide web
3 0
3 years ago
Read 2 more answers
One advantage of taking photographs under fluorescent light is that: Group of answer choices
Alexus [3.1K]

They tend to be dull.

7 0
3 years ago
Which of the following statements is the least abstraction of the world wide web
Sliva [168]
<span>Documents, images and other data you can access by providing a uniform Resource Locator. URL - the Web Address

I hope this helps. You didn't give me the choices to from.  </span>
8 0
3 years ago
Read 2 more answers
Yuri is a skilled computer security expert who attempts to break into the systems belonging to his clients. He has permission fr
Tatiana [17]

Answer:

b) White-hat hacker

Explanation:

This is also called an ethical hacker. Unlike the other options, a white-hat hacker is a person specialized on computational security which offers services to organizations to test how safe they are from informatic attacks (viruses, theft of information, etc). This is carried out  based on a agreement between the whihte-hat hacker and the client via a contract.  

8 0
3 years ago
Other questions:
  • How does microchip work
    12·1 answer
  • What is an electronic tool that stores large amounts of data in one place in a systematic, logical way? A Database B Platform C
    5·1 answer
  • A customer contacts the help disk stating a laptop does not remain charged for more than 30 minutes and will not charge more tha
    10·1 answer
  • Okay, guys, I know this one will be very hard however while trying to finish this assignment I got overwhelmed and lost by the s
    9·1 answer
  • Given a constant named size with a value of 5, which statement can you use to define and initialize an array of doubles named ga
    12·1 answer
  • Given the following array definition, write a constant declaration named ArraySize that automatically calculates the size in byt
    5·1 answer
  • In order to detect repeated lines anywhere in the input, myuniq must keep track of all of the lines it has seen as it moves thro
    9·1 answer
  • Who here has a crush on jk from bts but feels more mature than him
    10·2 answers
  • Which of the following is not a benefit of introducing an e-commerce solution to an organisation?
    14·1 answer
  • You are given a list of N integers . find the largest sum of a continuous sequence from the given list
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!