PROBLEM 25
Easy

Circle Circumference

Programming Basics · C++

</>
STATUS Not solved

TASK

Problem

#25

In “Circle Circumference”, read the required real value(s) and compute `2*pi*r`. Print the answer with 6 digits after the decimal point.

EXAMPLE

Example

Input
1.0
Output
6.283185

LIMITS

Constraints

Input magnitudes do not exceed 10^6; every denominator is non-zero.
📖
LEARN Theory for this problem
+

`double` stores real numbers. `fixed` together with `setprecision(6)` prints exactly six digits after the decimal point.

Connection to “Circle Circumference”: here, intermediate values are best kept in named variables so the formula stays readable and data types remain clear.

💡
NEED HELP? Hints
+

['Compute with `double`, then format the result at output.', 'After solving “Circle Circumference”, verify the algorithm on your own small example and on an allowed boundary case. Print only the required result with no extra text.']

ANSWER Solution
+
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
    double a;
    cin >> a;
    double result = 2*acos(-1.0)*a;
    cout << fixed << setprecision(6) << result << '\n';
    return 0;
}