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
jeka57 [31]
4 years ago
11

Write a recursive C++ function that writes the digits of a positive decimal integer in reverse order.

Computers and Technology
1 answer:
dangina [55]4 years ago
4 0

Answer:

// here is code in c++.

#include <bits/stdc++.h>

using namespace std;

// recursive function to print digit of number in revers order

void rev_dig(int num)

{

  if(num==0)

  return;

  else

   {

       cout<<num%10<<" ";

       // recursive call

       rev_dig(num/10);

   }

}

// driver  function

int main()

{

   int num;

   cout<<"enter a number:";

   // read the number from user

   cin>>num;

   cout<<"digits in revers order: ";

   // call the function with number parameter

   rev_dig(num);

   

return 0;

}

Explanation:

Read the input from user and assign it to variable "num". Call the function "rev_dig" with "num" parameter.In this function it will find the last digit as  num%10 and print it. Then call the function itself with "num/10". This will print the second last digit. Similarly it will print all the digits in revers order.

Output:

enter a number:1234                                                                                                        

digits in revers order: 4 3 2 1

Diagram :

You might be interested in
What is the output of the following code? Select all that apply c=0 while ( c &lt; 11 ) c = c + 6
Andreyy89

Answer:

crop=6

Explanation:

6 0
1 year ago
What is a database in access
aliya0001 [1]
Microsoft Access is a database management system (DBMS) from Microsoft that combines the relational Microsoft Jet Database Engine with a graphical user interface and software-development tools. ... It can also import or link directly to data stored in other applications and databases.
6 0
3 years ago
Anne wants to know more about rock music. How should Anne begin her search? a) browse the rock music category of a Web directory
galben [10]
B)Do a search on a search engine about rock music=this is how she should start.
6 0
3 years ago
A ____ in Excel is like a notebook
Amanda [17]
A notebook is ln excel is that what you are talking about?
7 0
3 years ago
2. During the information-gathering process, you want to make sure you address a list of highly technical questions concerning t
zalisa [80]

Answer:

A. Review of business documents

Explanation:

In information gathering process some research or resolving some technical issue, it is necessary to gather data or enlist highly technical questions concerning the overarching system that is already in place.

To gather answers that are enlisted above can be answered with the help of literature review or review of business document.

Literature review is the review of past work related to some particular topic that can be gather from different journal articles, conference publications or book.

3 0
3 years ago
Other questions:
  • Solve system of equations. <br>x+2y-z=4<br>2x-y+3z=8 <br>-2x+3y-2z=10
    12·1 answer
  • Please use Python 3 to solve the following problem. Please also show all outputs and share code.The variable sentence stores a s
    6·1 answer
  • Write the definition of a method dashedLine, with one parameter, an int. If the parameter is negative or zero, the method does n
    8·1 answer
  • You are the network administrator for a company with a single Active Directory domain. The corporate office is located in Miami
    5·1 answer
  • In which of the following situations may the taxpayer take an education expense on Schedule C? a. Henry, a self-employed adminis
    7·1 answer
  • Your company has purchased another company that also uses Windows Server 2016 and Active Directory. Both companies need to be ab
    11·1 answer
  • Help me with this, please. Are vacuum cleaners, Cd players, and telephones considered computers? Do they store any data or proce
    8·2 answers
  • The part of the computer that provides access to the Internet is the
    11·1 answer
  • Which of the following substances increases in quantity during repititive muscle contraction during oxygen deficti ?
    11·1 answer
  • What is the main circuit board inside the computer called?CD-ROMY
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!