Problem Statement
The problem statement contains the unicode symbols.
You are developing a new software calculator. A very important feature is the auto-placing of the ? value by one click. The only problem is that you don't know the required precision. That's why you decided to write a program that can return ? with any reasonable precision.
You are given an
Definition
- Class:
- PiCalculator
- Method:
- calculate
- Parameters:
- int
- Returns:
- String
- Method signature:
- String calculate(int precision)
- (be sure your method is public)
Notes
- ? equals 3.141592653589793238462643383279...
Constraints
- precision will be between 1 and 25, inclusive.
Examples
2
Returns: "3.14"
4
Returns: "3.1416"
The value should be rounded.
12
Returns: "3.141592653590"
Be careful with rounding.
1
Returns: "3.1"
3
Returns: "3.142"
5
Returns: "3.14159"
6
Returns: "3.141593"
7
Returns: "3.1415927"
8
Returns: "3.14159265"
9
Returns: "3.141592654"
10
Returns: "3.1415926536"
11
Returns: "3.14159265359"
13
Returns: "3.1415926535898"
14
Returns: "3.14159265358979"
15
Returns: "3.141592653589793"
16
Returns: "3.1415926535897932"
17
Returns: "3.14159265358979324"
18
Returns: "3.141592653589793238"
19
Returns: "3.1415926535897932385"
20
Returns: "3.14159265358979323846"
21
Returns: "3.141592653589793238463"
22
Returns: "3.1415926535897932384626"
23
Returns: "3.14159265358979323846264"
24
Returns: "3.141592653589793238462643"
25
Returns: "3.1415926535897932384626434"
4
Returns: "3.1416"
3
Returns: "3.142"
18
Returns: "3.141592653589793238"
25
Returns: "3.1415926535897932384626434"
1
Returns: "3.1"
5
Returns: "3.14159"
7
Returns: "3.1415927"