My issue
where I make mistake in this code for this problem??
give me hint or guide me,please
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
double pi = 3.14;
double radius = 8.9; //radius has to be declared as a 'double'
double area = pi * radius * 2;
cout << "The Area of the given Circle is ";
cout << area;
return 0;
}
Learning course: Learn C++
Problem Link: CodeChef: Practical coding for everyone
@jayambe7
The formula for finding area of a circle is not correct in your code.
The formula is; [ area = (pi * r * r) or, (pi * r-squared) ].
In your code, you are using formula for finding the circumference of a circle that’s why code is not being correct.
Here is my code for reference.
#include <bits/stdc++.h>
using namespace std;
int main() {
double pi = 3.14;
double radius = 8.9; //radius has to be declared as a 'double'
double area = pi * radius * radius;
cout << "The Area of the given Circle is ";
cout << area;
return 0;
}