1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sloan [31]
4 years ago
12

2.4 Code Practice: Question 2 Write a program that accepts a number as input, and prints just the decimal portion. Example: Ente

r a number: 15.789 Output: 0.789 Hint: Make sure to account for negative numbers!
Computers and Technology
1 answer:
vfiekz [6]4 years ago
6 0

Answer:

Explanation:

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)

You might be interested in
What are the objects in object-oriented programming language?
VMariaS [17]

Answer:

An object is an abstract data type with the addition of polymorphism and inheritance. Rather than structure programs as code and data, an object-oriented system integrates the two using the concept of an "object". An object has state (data) and behavior (code). Objects can correspond to things found in the real world.

hope it helps ya mate.

5 0
3 years ago
Create a cell array containing the same data as above (Do not use built-in functions such as cell2array, struct2cell, etc. but u
Anna71 [15]

Answer:

clc;

clear all;

disp('Creating the cell arr of required values')

arr = { 'Alejandro', 11, {3 5 7 9}, {0 0}, 'UCSD2016';...

{8 6 4 2 0 -2}, pi, 'Stephanie', {1 0}, {'(858) 273-0173'} }

disp('First row second column')

exp1 = arr(1 : 2, 2)

disp('Third element of 2nd row 1st column')

exp2 = arr{2, 1}(1,3)

disp('Deleting last 2 elements of 1st row 2nd column')

arr{1, 3}(3:4) = []

disp('log of 2nd row 2nd column')

arr{2, 2} = log(arr{2, 2})

disp('Swapping 1st row 1st column with 2nd row 3rd column')

temp = arr{2, 3};

arr{2, 3} = arr{1, 1}

arr{1, 1} = temp

disp('Deleting 2nd row 1st column elements')

arr{2, 1}(1:6)=[]

disp('Deleting third column')

arr(:,3) = []

6 0
3 years ago
The part of the poppet valve that contacts the valve seat is called the A. face. B. margin. C. head. D. stem.
Phantasy [73]
It should be A face, I think
6 0
3 years ago
Read 2 more answers
What are three good things and three bad things about the metal pewter
Setler79 [48]
Good things:
It is a solid material,NOT plated which makes it easily engravable.
does not tarnish or
discolor easily

Bad things:
It is not a high quality metal
It will melt at low temperatures,so do not get it around extreme heat.
It can damage easy if exposed to acids like lemon juice or vinager


4 0
4 years ago
Which statement best describes a computer program?
ziro4ka [17]

Answer:

B is the best answer.

Explanation:

All other options listed are related to a program but B beast answers the question.

7 0
2 years ago
Other questions:
  • Name format Many documents use a specific format for a person's name. Write a program whose input is: firstName middleName lastN
    14·2 answers
  • Define the missing method. licenseNum is created as: (100000 * customID) + licenseYear. Sample output: Dog license: 77702014
    14·1 answer
  • When choosing a new computer to buy, you need to be aware of what operating _____ a0 it uses.
    6·1 answer
  • A computer that no longer works after having minor repair work done to it may have been damaged by ____
    13·2 answers
  • Me2540 week 5 assignment<br> what do i want to know?
    9·1 answer
  • Consider a system running 10 I/O-bound processes and 2 CPU-bound process. Assume that the I/O-bound processes issue an I/O opera
    9·1 answer
  • What is wrong with the following code? How should it be fixed?
    12·1 answer
  • Create a network for a company that sells shoes. Describe the hardware needed and the size of the network (PAN, LAN, WAN) and ma
    6·1 answer
  • What's a False statement about online time? A. Blue light from devices can make it hard to sleep. B. It's a good way to connect
    5·1 answer
  • Mobile cameras are now of a higher quality than when they first arrived on the market. Describe the difference in
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!