2271737281 2271737281
  • 26-01-2022
  • Computers and Technology
contestada

Write a program that accepts a number as input and prints just the decimal portion. This
program should run with numbers with decimals and numbers without decimals.

Respuesta :

s906236
s906236 s906236
  • 26-01-2022

Answer:

Let's code it using python. We can take care of the negative number by placing an absolute function at the end. Basically the decimal part is calculated by subtracting the integer part from the original input number

def decimal_print(number):

   int_part = int(number)

   decimal_part = number - int_part

   return abs(decimal_part)

Explanation:

Answer Link

Otras preguntas

Why did the sardinians participate in the crimean war?
Calculate the kinetic energy of a 4.00kg object traveling at 16.0 m/s
What was the marshall plan intended to do?
The climate in the south is important because _____________________.a.it creates a very good environment for growing crops.c.it creates an environment safe from
Louise completed the work shown below.(5x3 3)2 = (5x3)2 (3)2 = 25x6 9determine if louise’s answer is correct. explain.
Who pushed the british out of persia in the 1920s?mahmoud ahmadinejadmustafa kemalayatollah khomeinireza pahlavi
4 List these fractions in order of size, starting with the smallest2 4 5 13 9 6 2
5. In the following sentence, which word is the adjective? The new employee knew how to use the copier. A. how B. new C. knew D. copier
Mr. ishimoto ordered x new math books and y new workbooks for his class. the total weight of the box of books cannot be more than 50 pounds. if each math book w
when bertie says he feels like a badly wrapped brown paper parcel he means that he feels