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
trapecia [35]
3 years ago
6

Write a program with class name Digits that prompts the user to input a positive integer and then outputs the number reversed an

d the sum of the digits. For example, if the user enters the number 3456, then your program should output 6543 and the sum as 18. Use a while loop. Hint: use the mod operator and 10 as divider to find the right most digit and to update the value of controlling expression
Computers and Technology
1 answer:
mr Goodwill [35]3 years ago
7 0

Answer:

Written in Python:

inputnum = int(input("User Input: "))

outputnum = 0

total = 0

while(inputnum>0):

     remainder = inputnum % 10

     outputnum = (outputnum * 10) + remainder

     inputnum = inputnum//10

     total = total + remainder

print("Reverse: "+str(outputnum))

print("Total: "+str(total))

Explanation:

This prompts user for input

inputnum = int(input("User Input: "))

This initializes the reverse number to 0

outputnum = 0

This initializes total to 0; i.e. sum of each digit

total = 0

The following iteration gets the reverse of user input

<em>while(inputnum>0): </em>

<em>      remainder = inputnum % 10 </em>

<em>      outputnum = (outputnum * 10) + remainder </em>

<em>      inputnum = inputnum//10 </em>

<em>      This adds each digit of user input</em>

<em>      total = total + remainder </em>

This prints the reversed number

print("Reverse: "+str(outputnum))

This prints the sum of each digit

print("Total: "+str(total))

You might be interested in
The smallest network
katrin [286]

Smaller networks include LANs or MANs.

Hope this is what you were looking for!

3 0
3 years ago
Why do you think that backlighting is used in so much of Sheldon’s photography?
Marianna [84]

Answer:

So you see the person better

Explanation:

4 0
4 years ago
Read 2 more answers
_______ is a way to minimize technical problems with your computer.
ikadub [295]
Hi,
The answer should be letter A.
7 0
3 years ago
Read 2 more answers
Which of the following is the best example of a manager with a delegator leadership style
monitta
No examples posted but here are a few examples;
Boss will send other employees to meetings in his/her place
Boss will leave other employees in. Charge when he/she is not there for a period of time.
Boss will assign special assignments
5 0
4 years ago
Read 2 more answers
Data management technology consists of the: Group of answer choices physical hardware and media used by an organization for stor
Illusion [34]

Answer:

software governing the organization of data on physical storage media.

Explanation:

Data management platform can be regarded as a foundational system utilized in collection and analyzing of large volumes of data across an organization. Data management encompass some variety of interrelated functions, the basic technology that is been utilized in

deployment and administering databases is regarded as database management system. Database technologies collect, store and also organize information then process it o that a user can easily finds needed details when they need it . It should be noted that Data management technology consists of the software governing the organization of data on physical storage media.

7 0
3 years ago
Other questions:
  • Let's say you're creating a search stream in your hootsuite dashboard, to find mentions of the phrase vacation holiday getaway.
    15·1 answer
  • Introduction to graphic design please help! Define the four terms: design ,art,decoration , and visual literacy. Describe how th
    12·1 answer
  • Your desktop, Internet Explorer®, and the Media Player can be started from this area on most computers.
    10·2 answers
  • What function does a security certificate perform
    15·2 answers
  • Alice is adding a chart in a spreadsheet. Which option will allow you her to give the chart a suitable title and subtitle?
    11·2 answers
  • Algorithmic Complexity: what is the asymptotic complexity (Big-O) of each code section? Identify the critical section of each.\
    8·1 answer
  • 2. An evil twin attack that broadcasts a legitimate SSID for an unauthorized network is an example of what category of threat? A
    9·1 answer
  • : Show that the propositions (p ∨ q) ∧ (¬p ∨ r) and (p ∧ r) ⊕ (¬p ∧ q) are logically equivalent.
    6·1 answer
  • Want to be friends on my switch? here :)! friend code: SW-5635-3847-1397​
    13·2 answers
  • Given two integer arrays, largerArray with 4 elements, and smallerArray with 3 elements. What is the result after this code exec
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!