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
ch4aika [34]
3 years ago
13

Write a program that takes a decimal number from the user and then prints the integer part and the decimal part separately. For

example, if the user enters 2.718, the program prints: Integer part = 2 and decimal part = .718 in python
Computers and Technology
1 answer:
svp [43]3 years ago
7 0

Answer:

Explanation:

The following was coded in Python as requested. It is a function that takes in a number as a parameter. It then uses the Python built-in math class as well as the modf() method to split the whole number and the decimal, these are saved in two variables called frac and whole. These variables are printed at the end of the program. The program has been tested and the output can be seen below.

import math

def seperateInt(number):

   frac, whole = math.modf(number)

   print("Whole number: " + str(math.floor(whole)))

   print("Decimals number: " + str(frac))

You might be interested in
Users can make notes or highlight areas of a website and then use the ________ feature of Microsoft Edge to send the highlighted
exis [7]

Answer:

Share.

Explanation:

Microsoft Edge is a web browser developed and hosted by Microsoft. It integrates cortana platform and other extensions, which are all hosted on Microsoft.

Just like every other browser, microsoft edge can interpret web codes values to its appropriate web page, it is simply used to browse the internet. When an area of the web page is highlight, copied or downloaded, it can be shared to other microsoft edge users through the share option.  

8 0
3 years ago
A customer in a store is purchasing five items. Design a program that asks for the price of each item, and then displays the sub
kykrilka [37]
What language are you programming in? 

<span>If you are programming in C or C++, you could do something like this: </span>

<span>#include <iostream> </span>
<span>using namespace std; </span>

<span>int main(void) </span>
<span>{ </span>
<span>//declarations </span>
<span>double item1 = 0; </span>
<span>double item2 = 0; </span>
<span>double item3 = 0; </span>
<span>double item4 = 0; </span>
<span>double item5 = 0; </span>
<span>double subtotal = 0; </span>
<span>double total = 0; </span>
<span>double tax = 0; </span>

<span>//Enter Items </span>
<span>cout << "Please enter the price of item 1"; </span>
<span>cin >> item1; </span>

<span>cout << "Please enter the price of item 2"; </span>
<span>cin >> item2; </span>

<span>cout << "Please enter the price of item 3"; </span>
<span>cin >> item3; </span>

<span>cout << "Please enter the price of item 4"; </span>
<span>cin >> item4; </span>


<span>cout << "Please enter the price of item 5"; </span>
<span>cin >> item5; </span>


<span>//Compute subtotal </span>
<span>subtotal = (item1 + item2 + item3 + item4 + item5 + item6); </span>

<span>//Compute amount of tax </span>

<span>tax = subtotal * (.06); </span>

<span>//Compute total </span>

<span>total = subtotal + tax; </span>

<span>//Display subtotal, total, and amount of tax </span>

<span>cout < " The subtotal of the sale is: " << subtotal << endl; </span>
<span>cout < " The amount of sales tax is: " << tax << endl; </span>
<span>cout < " The total of the sale is: " << total << endl; </span>

<span>return 0; </span>

<span>}//end of function main </span>


<span>I know this is a very very basic C++ program but I hope it helps and good luck on your project!</span>
5 0
3 years ago
In Python, which comparison operator means "less than or equal to"?
Komok [63]

Answer:

<=

Explanation:

Pretty much the same as in maths

3 0
3 years ago
Read 2 more answers
Does anyone have a rbx account? If they do friend request Tribalchief777
Mila [183]

Answer:

ok, no because this site is for hw

Explanation:

8 0
3 years ago
Which windows command always navigates the command-line interface back to the root directory?
Pie
The answer is "cd \".
5 0
3 years ago
Other questions:
  • What types of data are commonly entered into a cell ?
    7·2 answers
  • Which motherboard slot has direct access to the north bridge?
    7·1 answer
  • The Fibonacci numbers are the numbers
    15·1 answer
  • Create a loop that will output all the multiples of 5 that are greater than zero and less than 60 (do not include 60). 5, 10, 15
    10·1 answer
  • When including multiple images in a report, it may help to create a _____ on each image so you can cross reference them througho
    11·1 answer
  • Explain briefly why every person in the world is not connected to the Internet.
    9·1 answer
  • Write a paragraph on the following topic.
    14·1 answer
  • After turning on your computer ,it prompts you to type a password to continue the boot process. However ,you forgot the password
    10·1 answer
  • Cho lược đồ CSDL “Quản lý BÁN HÀNG” có các bảng như bên dưới. (Thuộc tính in đậm và
    7·1 answer
  • In your own opinion how comes the surface grinding machine is called a highly accurate machine tool?​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!