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]
3 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]3 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 file can you edit on a linux system to configure shared folders using samba?
TiliK225 [7]

/etc/samba/smb.conf is the file you can edit on a linux system to configure shared folders using samba.

<h3>What is a Linux system ?</h3>
  • A Unix-like operating system (OS) for desktops, servers, mainframes, mobile devices, and embedded devices, Linux is open source and user-developed.
  • One of the most broadly supported operating systems, it is supported on virtually all popular computing platforms, including x86, ARM, and SPARC.
  • Windows OS is a for-profit operating system, whereas Linux is an open-source alternative. In contrast to Windows, which lacks access to the source code, Linux allows users to modify the code as needed.
  • Applications, interfaces, programs, and software are all produced through Linux programming. Desktops, real-time apps, and embedded devices frequently employ Linux code.
  • Programmers can learn about the Linux kernel for free online, enabling them to use, modify, and develop Linux without restriction.

Learn more about linux system refer to :

brainly.com/question/25480553

#SPJ4

6 0
1 year ago
Ok so another weird question! So if you know what google drive is and how to upload a video why does it keep adding hours! it ke
lesya [120]

Answer:Your video may be too long and you may not have that much storage left.

Explanation:

5 0
3 years ago
A Java main method uses the parameter (String[ ] variable) so that a user can run the program and supply "command-line" paramete
Firdavs [7]

Answer:

The answer is "Option a"

Explanation:

  • In java, the main function is the point of entry of every java program. Its syntax always starts "public static void main" with (String args[]), in which it can also be modified by the name of the string array name.
  • It also known as an entry point is the key process. In any program, it is the first method, that executes whenever you run a program. There is one main feature in a regular app that uses instances of certain classes to operate.
4 0
3 years ago
An AM index between 0 and 1 indicates what? a. the AM signal is very small and will not be detected by the receiver b. distortio
Leto [7]

Answer:

Option c.

Explanation:

AM refers to the amplitude modulation.

AM refers to the modulation of a wave used as a means of broadcasting an audio signal by combining it with a radio carrier wave and varying its amplitude

An increase in message amplitude, Am, results in a higher AM Index.

An AM index between 0 and 1 indicates the received modulated signal will have minimal distortion.

So, option c. is correct.

7 0
3 years ago
 How do viral videos illustrate greater democracy of ideas?
irakobra [83]
I can not give you the direct answer but I can give you some ideas. The videos that go viral have an effect that makes peoples ideas clear and shows what people are into and then more people can get to know about these things.
4 0
3 years ago
Other questions:
  • The illustrations group contains all but a _______​
    9·1 answer
  • A publisher has a text-only leader board on top of a page, and a text-only small square ad slot within the content of that page.
    7·1 answer
  • What is connectivism and how does it apply to online learning?
    7·1 answer
  • A tablet computer transmits a file over a wi-fi link to an access point.
    13·1 answer
  • Create a program named Reverse3 whose Main() method declares three integers named firstInt, middleInt, and lastInt. Assign the f
    9·1 answer
  • Complete the problem about Olivia, the social worker, in this problem set. Then determine the telecommunications tool that would
    11·1 answer
  • Write an enhanced for loop that multiplies all elements in an int[] array named factors, accumulating the result in a variable n
    11·1 answer
  • Write an algorithm to find the average of three numbers: 10, 20, 30
    7·1 answer
  • What is the main function of the output on a computer or what is it use for? ​
    15·2 answers
  • Rewrite the code below so that a transformation moves the div 100px to the right and 50px upward.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!