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
asambeis [7]
3 years ago
14

Write a function, reverseDigit, that takes an integer as a parameter and returns the number with its digits reversed. For exampl

e: the value of reverseDigit(12345) is 54321; the value of reverseDigit(5600) is 65; the value of reverseDigit(7008) is 8007; and the value of reverseDigit(–532) is –235
Computers and Technology
1 answer:
Sedbober [7]3 years ago
5 0

Answer:

This program is written in C++. You can implement this program in any language. The code along with comments is given below in explanation section.

Explanation:

#include <iostream>  

using namespace std;  

int main()  // main function

{  

int number, reverseNumber=0, reminder;  //varible declaration  

cout<<"Enter a number: ";  //prompt user to enter the number  

cin>>number;   //save the entered number into number variable  

 while(number!=0)    //while number does not become zero.... remain in loop

 {    

    reminder=number%10;    // taken reminder of number    

    reverseNumber=reverseNumber*10+reminder;   //store the number digit into reverse order  

    number/=10; //decrease the number or shift the division to next digit    

 }    

cout<<"Reversed Number: "<<reverseNumber<<endl;    //print reversed number.  

return 0;  

}  

You might be interested in
1.Write a Java program to solve the following problem using modularity. Write a method that rotates a one-dimensional array with
Westkost [7]

Answer:

Explanation:

The following code is written in Java and it asks the user for the size of the array. Then it randomly populates the array and prints it. Next, it rotates all the elements to the right by 1 and prints the new rotated array.

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Random;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Random r = new Random();

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Size of the Array: ");

       int arraySize = in.nextInt();

       ArrayList<Integer> myList = new ArrayList<>();

       for (int x = 0; x < arraySize; x++) {

           myList.add(r.nextInt(15));

       }

       System.out.println("List Before Rotation : " + Arrays.toString(myList.toArray()));

       for (int i = 0; i < 1; i++) {

           int temp = myList.get(myList.size()-1);

           for (int j = myList.size()-1; j > 0; j--) {

               myList.set(j, myList.get(j - 1));

           }

           myList.set(0, temp);

       }

       System.out.println("List After Rotation :  " + Arrays.toString(myList.toArray()));

   }

}

6 0
2 years ago
The what toolbar can be customized to the preferences of the user
schepotkina [342]
Is this a multiple choice question?
7 0
3 years ago
What does cramming to hand in an assignment
Vikki [24]
Honestly gotta say cramming in an assignment doesnt help at all

5 0
3 years ago
Which of the following services provides hardware, an operating system, and a database management system (DBMS) on a cloud-based
Amanda [17]

Answer:

Infrastructure as a service(Iaas)

Explanation:

Infrastructure as a service(Iaas) is used to provide hardware,storage,servers and datacenter space or network components

4 0
3 years ago
What technology has had the most significant influence on engineering?
Lorico [155]
The wheel (: would be the correct answer
5 0
2 years ago
Other questions:
  • "You are on a service call to fix a customer’s printer when she asks you to install a software package. The software is on a per
    13·1 answer
  • PLEASE HELP ME!!!!
    12·2 answers
  • Write a program that does the following:
    11·1 answer
  • Joe, a user, wants his desktop RAID configured to allow the fastest speed and the most storage capacity. His desktop has three h
    12·1 answer
  • A network that has locations in different countries is considered a WAN.<br> a. Trueb. False
    12·1 answer
  • Explain why you cannot the Apple OS install on a regular windows computer and vice versa, without the aid of a virtualization so
    5·1 answer
  • Which is a connectionless protocol in the transport layer? What are the small chunks of data called?
    12·2 answers
  • RSA encryption relies on
    15·1 answer
  • Which statement best describes the computers all around us?
    15·1 answer
  • What happens when you create a variable in a video game program?​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!