fork download
  1. #include <iostream>
  2. #include <cmath> // for M_PI constant
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. float radius, area;
  8.  
  9. cout << "Enter the radius of the circle: ";
  10. cin >> radius;
  11.  
  12. // Use M_PI from cmath for a more precise value
  13. area = M_PI * pow(radius, 2.0);
  14.  
  15. cout << "Area of the circle with radius " << radius << " is " << area << endl;
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 5304KB
stdin
Standard input is empty
stdout
Enter the radius of the circle: Area of the circle with radius 4.59163e-41 is 0