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
leva [86]
4 years ago
6

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

: 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:
arlik [135]4 years ago
3 0

following are the code in c language

#include<stdio.h> // header file  

int reverseDigit(int n);  // prototype of  reverseDigit function

int main()  // main method

{

int n;  // variable declaration

printf("Enter a number to reverse\n");

scanf("%d", &n);  // input value by user

int t=reverseDigit(n);  // calling  reverseDigit function

printf("the value of reverseDigit(%d)",n);  

printf(" is %d",t); // display reverse digit

 return 0;

}

int reverseDigit(int n)   // function definition of reverseDigit function

{

   int r=0;

    while(n!=0)  // iterating over the loop

  {

     r = r* 10;

     r= r+ n%10;

     n= n/10;

  }

  return(r);  // return the reverse digit

  }

Explanation:

In this we call a function  reverseDigit, from the main function after calling control moves to the definition of  reverseDigit, function ,the while loop is iterating .In the while loop, we find the remainder r when number is divided  by 10 then it will multiplied by 10 and add previous remainder after that number will be updated as n/10 . Then function will return number r and print them in main function.

output

Enter a number to reverse

12345

the value of reverseDigit(12345) is 54321

You might be interested in
The number of protons plus the number of nuetrons equal the <br> A.atomic weight<br> B.atomic number
mash [69]
Atomic mass will be the answer according to your question .
For ex - atomic mass of oxygen is equal to 8+8 I.e. 16
Hope u understand by this
5 0
3 years ago
Folders are containers used to organize the documents into manageable groups on a designated storage device. true or false
AysviL [449]

Answer:

true

Explanation:

folders are used to organize documents into manageable groups on storage devices

5 0
3 years ago
What is the function of a data bus
choli [55]

To gather data from its inputs

4 0
3 years ago
What is required for real-time surveillance of a suspects computer activity?/p Group of answer choices a. Blocking data transmis
Hitman42 [59]

Answer:

c  Preventing data transmissions between a suspect’s computer and a network server

Explanation:

3 0
3 years ago
______ includes websites that encourage interaction and connection among people, businesses, and organizations.
Mice21 [21]
That answer would be, (B) Search Engines
6 0
3 years ago
Other questions:
  • write a pseudo code and flow chart that take a number as input and prints multiplication table up to 10
    9·1 answer
  • john wants to view sarah's assignment files on his computer. but he cannot open them because of version problems. which upgrade
    14·2 answers
  • Why does fiber optic communication technology have a significant security advantage over other transmission technology? higher d
    6·1 answer
  • 2. Design a class named Sandwich with data fields for description and price. Include a constructor that requires arguments for b
    14·1 answer
  • Which is true about POP3 and IMAP for incoming email?
    10·1 answer
  • SOMEONE HELP PLEASE!!!!!
    6·1 answer
  • You are in charge of an event at work. You want to plan and schedule events and resourse. What type of software should you use?
    14·2 answers
  • What will be the results from running the following code?
    5·1 answer
  • Which federal legislation prohibits credit card companies from raising rates on existing balances?
    10·2 answers
  • Question 1 of 10
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!