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

What is the difference between a fine focus and coarse focus knob?
log3/5 25/9=x-2 ? algebra 2
Can you solve this for me by: Factor out the GCF. Then continue to factor by using other methods.2a² -32
For the missing term in the geometric sequence, Find the possiblefor the missing term in the geometric sequence, Find the possible values.4, ?, 1/36
why was boise chosen for Idaho's capital
what contrasts of sound did composers stress?
How many 6 digit number combinations are there?
Why does a compass point to the east or west of true north in different locations?
A bee flies 25 m north of the hive, then 10 m east, 5 m west , and 10 m south. How far north and east of the hive is it now? Exsplain how u calculated your answ
What is the difference between a fine focus and coarse focus knob?