Create a single MATLAB statement that will print pi to 4 dec
Create a single MATLAB statement that will print pi to 4 decimal places.
Solution
When you donot specify any condition, the pi value will be taken as
pi
To obtain only 4 digits after the decimal point
Set the output format to the short engineering format with compact line spacing
format shortEng
pi
Ans =
3.1415e+000
