URI Online Judge Solution | 1002 Area of a Circle [Solve]

The input contains a value of floating point (double precision), that is the variable R.

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email
75

uri online judge solve

The formula to calculate the area of a circumference is defined as A = π . R2. Considering to this problem that π = 3.14159:

Calculate the area using the formula given in the problem description.

Input

The input contains a value of floating point (double precision), that is the variable R.

Output

Present the message “A=” followed by the value of the variable, as in the example bellow, with four places after the decimal point. Use all double precision variables. Like all the problems, don’t forget to print the end of line after the result, otherwise you will receive “Presentation Error”.

Input SamplesOutput Samples
2.00A=12.5664
100.64 A=31819.3103
150.00 A=70685.7750

———Solve———

#include <stdio.h>
#define pi 3.14159
int main()
{

    double A,R;
    while(scanf("%lf",&R)==1)
    {

        A = pi * R * R;
        printf("A=%.4f\n",A);

    }


    return 0;
}

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Do You Want To Contact With me?

drop us a line and keep in touch