Question: write a program to read a decimal number (d) and an integer number (n) to round d to n digits after decimal point. If the

write a program to read a decimal number (d) and an integer number (n) to round d to n digits after decimal point. If the number of digits after decimal point are < n, then add more zeros to make it exactly n digits after the decimal point NOTE your function must act like the setprecision and showpoint functions in C++.

Sample I/O

Enter a decimal number followed by an integer number: 4.23675 3

Your number after being round to 3 digits is 4.238

CONTINUE(y/n)? y

Enter a decimal number followed by an integer number: 9.46 4

Your number after being round to 3 digits is 9.4600

CONTINUE(y/n)? n

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!