Develop an M-file function called rounder to round a number x to a specified number of decimal

Question:

Develop an M-file function called rounder to round a number x to a specified number of decimal digits, n. The first line of the function should be set up as

function xr = rounder(x, n)

Test the program by rounding each of the following to 2 decimal digits: x = 477.9587, − 477.9587, 0.125, 0.135, − 0.125, and − 0.135.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: