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
9.19 LAB: Words in a range (lists) Write a program that first reads in the name of an input file, followed by two strings repres
Anestetic [448]

Answer:

9.2. Métodos del Objeto File (Python para principiantes)

Explanation:

8 0
2 years ago
Describe how to add slide numbers and image to a Microsoft power point presentations ?​
Dafna11 [192]
Oh we did this in class I know this
6 0
2 years ago
The ____________________ packet-filtering firewall allows only a particular packet with a particular source, destination, and po
kolbaska11 [484]

Answer:

Dynamic packet-filtering firewall.            

Explanation:

Packet filtering is basically a technique of scanning and filtering the network data packets. This technique allows or disallows the network packets to enter through the firewall or to transmit from one network to the other. Dynamic packet filtering packet-filtering firewall allows only a particular packet with a particular source, destination, and port address to enter through the firewall. It utilizes the information in packet header and inspects and utilizes active connections state information. This information enables to decide which packet should enter through the firewall.

8 0
3 years ago
Only the _________ can add users with passwords and limit user access to selected areas.
Iteru [2.4K]

Answer:

The answer to this question is "Quickbooks administrator.

Explanation:

The answer is the Quick books administrator because Quick books is a software that is used for accounting developed. It helps us to keep in mind all the expenses in the business and things like invoicing, reporting.In this software, we can add new users and give them permission. If we want to allow Users to access the software.

In the Quickbooks administrator, we can add the user with limited access also. So the correct answer is Quickbooks administrator.

8 0
3 years ago
A trench is a narrow excavation in which the depth is greater than the width and the width does not exceed 15 feet. A. False B.
Arturiano [62]
I think it is false
4 0
3 years ago
Read 2 more answers
Other questions:
  • What is the maximum amount that OSHA can impose as a penalty on an employer for each Willful violation?
    11·1 answer
  • Help me match these answers
    5·1 answer
  • Is USA TestPrep a test-taking site that won't let you access other windows without kicking you off?
    13·1 answer
  • Last week, a disk containing CSM Tech Publishing’s current project manuscripts crashed. Fortunately, there was a backup, but all
    15·1 answer
  • When two or more tables share the same number of columns, and when their corresponding columns share the same or compatible doma
    12·1 answer
  • The 'WIMP' environment is much more user friendly,why?​
    11·2 answers
  • What are the columns in a Microsoft Access table called?
    15·1 answer
  • b. Write a complete program for the following situation related to setting the speed of a car to preset values before starting a
    5·1 answer
  • You can put ______ on your phone.
    10·1 answer
  • 30 Points!!
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!