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
Which support function under Tech Mahindra is governing data privacy and protection related requirements
Alex Ar [27]

Answer:

Privacy Policy

Explanation:

PRIVACY POLICY is the support function under Tech Mahindra that is governing data privacy and protection-related requirements.

Given that support functions are functions which assist and in a way contribute to the company goal.

Other support functions are human resources, training and development, salaries, IT, auditing, marketing, legal, accounting/credit control, and communications.

The above statement is based on the fact that the Privacy Policy clarifies all the data protection rights, such as the right to object to some of the production processes that TechM may carry out.

7 0
3 years ago
People who are reading this:
Gnom [1K]

Answer:

Awe thanks hun!

Explanation:

3 0
3 years ago
Read 2 more answers
You have been given a laptop to use for work. You connect the laptop to your company network, use it from home, and use it while
VashaNatasha [74]
  • You can get a antivirus subscription that will kill malwares
  • Also, you can avoid going on websites you don't trust
  • I hope this helps you.
4 0
3 years ago
Which is true regarding pseudocode?
drek231 [11]

Answer:

It uses simple words and symbols to communicate the design of a program.

Explanation:

4 0
3 years ago
Read 2 more answers
Is The speed of microprocessor measured by Mega Bytes​
DiKsa [7]

Answer:

El microprocesador (o simplemente procesador) es el circuito integrado central más complejo de un sistema informático; a modo de ilustración, se le suele llamar por analogía el «cerebro» de un ordenador.1​

Es el encargado de ejecutar todos los programas, desde el sistema operativo hasta las aplicaciones de usuario; solo ejecuta instrucciones en lenguaje binario, realizando operaciones aritméticas y lógicas simples, tales como sumar, restar, multiplicar, dividir, las lógicas binarias y accesos a memoria.

Puede contener una o más unidades centrales de procesamiento (CPU) constituidas, esencialmente, por registros, una unidad de control, una unidad aritmético lógica (ALU) y una unidad de cálculo en coma flotante (conocida antiguamente como «coprocesador matemático»).

El microprocesador está conectado generalmente mediante un zócalo específico de la placa base de la computadora; normalmente para su correcto y estable funcionamiento, se le incorpora un sistema de refrigeración que consta de un disipador de calor, fabricado de algún material de alta conductividad térmica, como cobre o aluminio, y de uno o más ventiladores que eliminan el exceso del calor absorbido por el disipador. Entre el disipador y la cápsula del microprocesador usualmente se coloca pasta térmica para mejorar la conductividad del calor. Existen otros métodos más eficaces, como la refrigeración líquida o el uso de células peltier para refrigeración extrema, pero estas técnicas se utilizan casi exclusivamente para aplicaciones especiales, tales como en las prácticas de overclocking.

La medición del rendimiento de un microprocesador es una tarea compleja, dado que existen diferentes tipos de "cargas" que pueden ser procesadas con diferente efectividad por procesadores de la misma gama. Una métrica del rendimiento es la frecuencia de reloj que permite comparar procesadores con núcleos de la misma familia, siendo este un indicador muy limitado dada la gran variedad de diseños con los cuales se comercializan los procesadores de una misma marca y referencia. Un sistema informático de alto rendimiento puede estar equipado con varios microprocesadores trabajando en paralelo, y un microprocesador puede, a su vez, estar constituido por varios núcleos físicos o lógicos. Un núcleo físico se refiere a una porción interna del microprocesador casi-independiente que realiza todas las actividades de una CPU solitaria, un núcleo lógico es la simulación de un núcleo físico a fin de repartir de manera más eficiente el procesamiento. Existe una tendencia de integrar el mayor número de elementos dentro del propio procesador, aumentando así la eficiencia energética y la miniaturización. Entre los elementos integrados están las unidades de punto flotante, controladores de la memoria RAM, controladores de buses y procesadores dedicados de vídeo.

Explanation:

6 0
3 years ago
Other questions:
  • Perhaps programs used for business purposes ought to conform to higher standards of quality than games. With respect to software
    7·1 answer
  • An excel user should use a relative cell reference when it is important to ____. preserve the relationship to the formula locati
    7·1 answer
  • Which of the following commands would I use to begin a new presentation?
    14·1 answer
  • Pros and cons of access to a wide range of online services when it comes to an individual's safety?
    14·1 answer
  • ERP implementation probably will not require:
    8·2 answers
  • Drag each tile to the correct box.
    12·1 answer
  • What is the phase of a waveform ?
    15·1 answer
  • How can you make a search phrase more effective?
    11·1 answer
  • You can use tables for layout work. However, in XHTML, each form control should have its own ______ element
    12·1 answer
  • Do you need a separate password for each slack channel
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!