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
_______ is the process of checking data for validity and completeness
timurjin [86]
Data Editing is the answer
7 0
2 years ago
A group of non-English speaking employees will be temporarily working in your building. You need to change the setup screen on t
Taya2010 [7]

C- Make the change through BIOS setup.

7 0
3 years ago
Read 2 more answers
Which key or keys do you press to indent a first-level item in a list so it becomes a second-level item
frozen [14]

This would be the Tab key

6 0
3 years ago
How do a Tip Calculator in Visual Studios?
luda_lava [24]
Sorry but I don’t know?
7 0
3 years ago
List the steps you would take to create folders/directories in different operating system environments.
zaharov [31]

In Linux we use the terminal to create files and folders.

To create a folder:

1. Open a terminal

2. Go to a directory where you want to create the folder

3. Use the change directory command to go to the directory.

4. Use the mkdir command to make a folder

To create a file:

1. Open a terminal

2. Go to a directory where you want to create a file.

3. use the touch command followed by the filename.

Example to create a directory:

mkdir foldername

Example to create a file:

touch file.txt

4 0
2 years ago
Read 2 more answers
Other questions:
  • While working a night job at a call center, Eric creates an app called EatOut, which can be used to place orders at restaurants,
    14·1 answer
  • Which of the following is an accurate explanation of what this paragraph means?
    7·1 answer
  • Which method do software testers use to isolate new code from the rest of the network during the test stage of the software deve
    15·1 answer
  • The loss of privacy data has implications:
    5·1 answer
  • This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by
    8·1 answer
  • You have been using the same computer for several years. To extend its service life, you decide to upgrade the processor. You ch
    13·1 answer
  • I will give Brainliest to the best answer, I need urgent HELP
    7·1 answer
  • I need help plz
    14·2 answers
  • Give a detailed example of how an app (that you use regularly)uses parameters. You must state the app's name and function, the p
    7·1 answer
  • What type of platform is Twitter?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!