Question
Write a function that accepts a string parameter containing a list of numbers and prints the sum of these numbers as follows (this is not
Write a function that accepts a string parameter containing a list of numbers and prints the sum of these numbers as follows (this is not a regular sum so read instructions carefully):
A) you do not know how many numbers,
B) all the numbers must be on the same input line.
C) some numbers may not have decimal places
For each number: the function will remove any fraction digit more then one decimal place.(example: 10.8756942 ---> 10.8) do not round
The function will then add those numbers and display the result.
Example: (note: original sum would've been 74.9813)
given string s = "10.8787 12.7256 10 5.698 3.446 11 12 5.787";
The function will display:
These numbers are:
10.8 12.7 10 5.6 3.4 11 12 5.7
The sum is: 71.2
Step by Step Solution
There are 3 Steps involved in it
Step: 1

Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2

Step: 3

Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started