fork download
  1. #include <iostream>
  2. #include <iomanip> // for std::setprecision
  3.  
  4. int main() {
  5. // 원의 반지름
  6. double radius = 4.0;
  7. // 원주율
  8. double pi = 3.14;
  9.  
  10. // 원의 넓이 계산
  11. double area = pi * radius * radius;
  12.  
  13. // 결과를 소수점 이하 둘째 자리에서 반올림하여 첫째 자리까지 출력
  14. std::cout << std::fixed << std::setprecision(1) << area << std::endl;
  15.  
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
50.2