MATLAB: Changing number of digits

digitspi

I am trying to display the exact first 6 digits of pi how to do that ?

Best Answer

Here is one way to display the first 6 digits of pi (after the decimal place) ...
sprintf('%6f',pi)
See the details, e.g. format specification, in the documentation for sprintf.
Related Question