fork download
  1. #include <stdio.h>
  2.  
  3. #define PI 3.14159 // Định nghĩa hằng số PI
  4.  
  5. int main() {
  6. float radius; // Biến để lưu bán kính
  7. float area; // Biến để lưu diện tích
  8.  
  9. // Yêu cầu người dùng nhập bán kính
  10. printf("Enter the radius of the circle: ");
  11. scanf("%f", &radius);
  12.  
  13. // Tính diện tích của hình tròn
  14. area = PI * radius * radius;
  15.  
  16. // Hiển thị diện tích
  17. printf("The area of the circle with radius %.2f is %.2f\n", radius, area);
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Enter the radius of the circle: The area of the circle with radius 0.00 is 0.00