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 difference between asking a question with few points and asking a question with many? New to Brainly :D
ANTONII [103]

Answer:

one would be more helpful and the other more vague and less convincing.

6 0
3 years ago
Question 3 : what tool can diagnose and fix many common linux filesystem problems?
vaieri [72.5K]
The t<span>ool that can diagnose and fix many common linux file system problems is </span>fsck.  fsck, is Linux's file system check utility. It's similar in purpose to the DOS and Windows CHKDSK and ScanDisk utilities. 
3 0
3 years ago
You use the same five shell functions every day and are looking for a way to ensure they are available as soon as you log into y
ANTONII [103]

Answer:

.c. Load them via your login script.

Explanation:

Given that using functions in shell scripts enhances programming output and login script comprises the functions and statements required to effectively execute at any given time the user logs into their account.

Hence the moment these functions are formulated, they are then executed through a single command statement thereby reducing the time of re-writing another set of code repeatedly in every program.

Therefore, in this case, what you can do is to "Load them via your login script."

4 0
3 years ago
Internet control message protocol (icmp) is a method of ip address assignment that uses an alternate, public ip address to hide
Elanso [62]
B False





---------------------------------
3 0
4 years ago
How to Turn in a file as PDF in any type version of Microsoft word?????
brilliants [131]

<span>Open the file in Office Word 
</span><span>Click the "File" tab and go to <span>Save As
</span></span>
<span>In the "File Types" field, choose Create PDF or XPS Document.
</span><span>Click "Create a PDF/XPS".
</span>
<span>In the pop-up dialog box, enter a file name and location.
</span>
<span>Click Publish.
</span>http://www.wikihow.com/Convert-a-Microsoft-Word-Document-to-PDF-Format
5 0
3 years ago
Other questions:
  • Why does dns use udp instead of tcp? if a dns packet is lost, there is no automatic recovery. what are the consequences?
    11·1 answer
  • What programming languages should a mathematician learn?
    6·1 answer
  • Linux is
    8·1 answer
  • Must be at least 6 characters and contain at least one letter, one number and one special character. whats a good password? ive
    12·1 answer
  • ____________ signs, as discussed by Charles Peirce, involve an "existential" relationship between the sign and the interpretant.
    6·1 answer
  • 2- (8 point) Write a program using the instructions below. Assume that integers are stored in 4 bytes. a) Define an array of typ
    10·1 answer
  • Preciso de ajuda urgente, é para amanhã cedo!!
    10·1 answer
  • Comprehension s best described as the ability to
    15·2 answers
  • Can somebody tell me the Minecraft command to clear an entire world and destroy every block if u Dunno please don’t answer &gt;-
    13·1 answer
  • Most computers include a network card designed to connect a computer to the net using standard telephone service. True or False?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!