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

On a recent 160 mile road trip, clara's car used 6.25 gallons of gas. how many gallons should she expect to use on a 250 mile road trip?
What is the least common multiple of four and nine?
How is cell division different in prokaryotes and eukaryotes?
math help w/ triangles please
31 POINTS PLEASE HELP WILL GIVE BRAINLIEST A rental car company charges $15 per day for a rental car plus 20¢ for every mile driven that day. Which equation mod
14.6 as a mixed number
What were some accomplishments of Alexander Hamilton?
Who is speaking in the poem a tree telling of orpheus
Solve the following inequality: 2(x + 1) – (–x + 5) ≤ –18
Why is cancer considered a disease of the cell cycle?