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
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