Question: Hi, I want to create a python and c++ program for the following can you show me how to do it plz create a program
Hi, I want to create a python and c++ program for the following can you show me how to do it plz
create a program that will accept a number with decimals
-
you then tell the program how many decimal places you want to round off to
-
the program then passes the variables in by reference to a function and rounds it off to that many decimal places
-
you CAN NOT use any built in rounding function
-
Hint:
-
multiply number by 10 to the power of how many decimal points you want
-
add 0.5
-
convert to integer
-
move decimal point back
-
-
for python you can not pass a primitive type by reference so you will have to pass the variable in a list
example of what it looks like

Enter the number you want to round: 5.6678 Enter how many decimal places you want to round by: 1 The rounded number is 5.7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
