Users must enter the number of decimals to which the value of pi should be calculated.

The math.acos() method returns the arc cosine value of a number. The value of Π is calculated using acos() function which returns a numeric value between [-Π, Π]. Since using acos(0.0) will return the value for 2Π. Therefore to get the value of Π : pi = round(2acos(0.0));

The round() function returns a floating-point number that is a rounded version of the specified number, with the specified number of decimals.

Built With

Share this project: