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
Xelga [282]
2 years ago
8

Write a program that accepts three decimal numbers as input and outputs their sum​

Computers and Technology
2 answers:
Sophie [7]2 years ago
6 0

Answer:

sum = 0.0

for i in range(0,3):

   sum += float(input("Enter a decimal number to sum: "))

print ("Sum: ", sum)

*** Sample Input ***

Enter a decimal number to sum: 1.1

Enter a decimal number to sum: 2.2

Enter a decimal number to sum: 3.3

*** Sample Output ***

Sum:  6.6

Explanation:

For this problem, a method was devised in python to create the sum of three individual decimal numbers.

The first line of code, <em>sum = 0.0</em>, initializes a variable to the float type in which we will store the value of our sum.  Note, it is initialized to 0.0 to start from a value of 0 and be considered a float.

The second line of code, <em>for i in range(0,3):</em>  is the creation of a for loop control structure.  This will allow us to repeat a process 3 amount of times using the iterator i, from value 0 to 3 in this case.  Note, 0 is inclusive and 3 is exclusive in the python range.  This means the for loop will iterate with, i=0, i=1, and i=2.

The third line of code, <em>sum += float(input("Enter a decimal number to sum: "))</em>  is simply asking the user for a number, taking that input and converting it from a string into a float, and then summing the value with the previous value of sum and saving that into sum.

The fourth line of code, <em>print ("Sum: ", sum)</em> is simply displaying the final value that was calculated by adding the three user inputs together which were stored into the variable <em>sum</em>.

Cheers.

mina [271]2 years ago
4 0

Answer:

a = float(input("Enter an integer: "))

b = float(input("Enter an integer: "))

c = float(input("Enter an integer: "))

print (a + b + c)

Explanation:

Takes three numbers that user inputs and outputs their sum (of whatever numbers are given.)

You might be interested in
How many bits are required to encode an image that is 25 pixels wide and 50 pixels tall, if you encode each pixel with 12 bits o
AURORKA [14]

Just multiply all numbers to get the total number of bits:

25*50*12 = 15000 bits.

3 0
3 years ago
Advantages of monolithic operating system? ​
Lyrx [107]

Advntage:

provides CPU scheduling, memory management, file management, and other operating system functions through system calls. The other one is that it is a single large process running entirely in a single address space.

Disadvantage: if anyone service fails it leads to an entire system failure

8 0
2 years ago
Jasmine is a commercial artist her is is the one most often used by graphic designers publishers and others in her field the os
VikaD [51]
OS is for mac so she used the mac computer
7 0
2 years ago
Before renting or buying a multifamily dwelling you should know the __ of the building
mel-nik [20]
You should know the units :))))))))))))
8 0
2 years ago
Read 2 more answers
A acrostic sentence for mutualism?
melamori03 [73]
Must have
Understand
Today for
Urgent
Answer
List it too
It's not hard
So listen to
Me
6 0
3 years ago
Other questions:
  • When ordering a new​ zagflatz, customers must choose the style of three major​ components, each of which has about ten variation
    6·1 answer
  • Define the following terms:<br><br> - pigment<br> - vehicle<br> - binder<br><br> plz help
    12·2 answers
  • Your neighbor has moved to another country. He informs you about his new job. You wantto congratulate him by sending an e-mail m
    13·1 answer
  • You are designing a wireless network for a client. Your client needs the network to support a data rate of at least 54Mbps. In a
    11·1 answer
  • In the accompanying figure, the split double arrow mouse pointer____.
    7·1 answer
  • What is wrong with each of the following?
    6·1 answer
  • Outline four types of cyber law.
    14·1 answer
  • Use the drop-down menus to complete the steps to share a presentation through OneDrive.
    6·1 answer
  • Is spin to win paying or is a scam app​
    6·2 answers
  • What are the syntax of c programming language?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!