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

x + 4 1/3 = -2 5/6 find x
A cylinder with radius 3 feet and height 5 feet is shown. Enter the volume of the cylinder in cubic feet. Round your answer to the nearest hundredth.
The speed limit on a higway is 70 miles per hour/ About how fast is this in miles per minute?
Touching a hot stove stimulates which type of sensory receptor? a. pain receptor b. mechanoreceptor c. chemoreceptor d. photoreceptor
How can you tell the difference between a ray and a line segment? Draw and label an example of each below
Which of the following compounds would be primarily ionic? Methane CH4 , Ammonia NH3, Calcium Chloride CaCL2 or Carbon dioxide, CO2
someone please help ASAP will give brainliest
What is the value of x?
Kabuki is a form of drama that? A. Influenced the developmental Noh B. Was performed for the common people C. Was popular at the Heian court D. Took place on a
PLEASE HELP! :) Which organization is an example of the second great awakening‘s influence on Society? A. American medical Association B. No nothing party