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
What is output by the following?<br><br>print (type("95"))
statuscvo [17]

Answer:

The output is "<class 'str'> ".

Explanation:

In the given python code a print() function is defined. Inside this function, a type() function will use, in which a numeric value is passed in the double quotes (" ") as a function parameter. Double quotes are normally used for print value as a message but in this code, value is not printed because we use the type() function.

  • The type() function Returns the parameter class type of the argument(object).
  • This function is used for debugging. In this function, we pass a single parameter that will return the type of given object.
6 0
3 years ago
Abdul wants to create a header for a webpage and enters this line: Welcome to Abdul’s webpage! , but the title is smaller than w
leonid [27]

Answer:

I think H1

Explanation:

because h1 can make the letters begger

5 0
3 years ago
Bethany is in her home, watching a video she took on vacation, while her brother is playing FIFA Soccer on his Xbox, and her dad
Sati [7]

Answer:

P2P network is the correct answer to the following question.

Explanation:

Because the P2P network is the network that is used to share the resources of the computer system. It also allows the users to link two or more than two computer systems and also allows them to share all kinds of resources of the system. So, that's why Bethany and her family members used the P2P network type.

4 0
3 years ago
How is your approach to solving how to order your coins different from how a computer might have to approach it?
Finger [1]

Answer: Computer solves the order of coins the way its programmed to while you solve the order of coins the way you want.

8 0
3 years ago
The school tie is made from a piece of fabric measuring 135cm long by 9cm wide. The fabric is supplied in a roll that is 90mm wi
yawa3891 [41]

Answer:

The cost to make one tie is approximately £4.79

Explanation:

The details of the dimensions of the fabric needed to make the school tie are;

The length of the required fabric = 135 cm

The width of the fabric for the tie = 9 cm

The width of a roll of fabric when sold = 90 mm = 9 cm

The cost of the fabric per meter = £3.55

The width of the roll of fabric = The width of the  fabric material required to make a tie

1 meter  = 100 cm

The cost of 1 m (100 cm) of fabric = £3.55

Therefore;

The cost of the 135 cm of the fabric required for the tie, <em>c</em>, is found as follows;

c = £3.55 × 135/100 = £4.7925

The cost of the fabric required to make one tie giving the answer to two decimal place, c ≈ £4.79

5 0
3 years ago
Other questions:
  • Explain free space allocation?
    9·1 answer
  • What standard linux utility is used to install and configure software on centos operating systems?
    8·1 answer
  • Diane wants to maintain a record of percent change in sales from the year 2000 to the present year. She enters the values of per
    10·1 answer
  • In order to plan George’s birthday, his father gave him a list of people who attended his birthday for the last five years. What
    8·1 answer
  • The three devices you are going to install are a 2u server, a 1u keyboard tray, and an 8u space for a rack mounted moitor. Given
    6·1 answer
  • Server 2016 is compatible for Powershell 5.0 State True or False.
    7·1 answer
  • The private field, which is known as the property‘s __________, holds any data that is assigned to the property.a. private datab.
    9·1 answer
  • categorize each job role as an administrative job or management job auditor director legal secretary payroll clerk etc ​
    8·1 answer
  • Compare and Contrast - What is your opinion of the new VEX coding software.
    6·1 answer
  • Why accessing information over the internet is so convenient.​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!