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

How much less than 1 is 3/9? Is the answer to this question 1/3???
Rationalize the denominator and simplify-[tex] \frac{ \sqrt{6} }{ \sqrt{3} - \sqrt{2} } [/tex]
Hey there this is Japanese What is the meaning of :1) sugoi2) takai
a) six pens and five pencils cost $2.50 while three pens and two pencils cost $1.15 . what will be the cost of a pen and 4 pencils . please help me
How much less than 1 is 3/9? Is the answer to this question 1/3???
What are the advantages and disadvantages of DNA foresics/analysis?
What are the advantages and disadvantages of DNA foresics/analysis?
when it is winter in europe, what season is it in asia and why?
The time t required to drive a certain distance varies inversely with the speed r. If it takes 2 hours to drive the distance at 40 miles per hour, how long will
a) six pens and five pencils cost $2.50 while three pens and two pencils cost $1.15 . what will be the cost of a pen and 4 pencils . please help me