

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
r1,r2 = map(float,input().split())
pi = 3.1415926535897
print("{:.4f}".format(abs((r2*r2*pi-r1*r1*pi))))
Hãy giúp mọi người biết câu trả lời này thế nào?
*C++, cần Pascal, Python bảo nhé !
#include <bits/stdc++.h>
const double PI = 3.1415926535897 ;
using namespace std;
int main(){
float r1, r2 ;
cout << "r1= "; cin >> r1;
cout << "r2= "; cin >> r2 ;
cout << "Dien tich hinh vanh khan la:" << fixed << setprecision(4) << abs(pow(r2,2) * PI - pow(r1,2) * PI) ;
}
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin
5599
4859
3498
1 số trường hợp round sai
4327
2546
1958
th nào
5599
4859
3498
print(abs(round(r2*r2*pi-r1*r1*pi,4))) `=>` print("{:.2f}".format(abs((r2*r2*pi-r1*r1*pi,4))))
5599
4859
3498
Ê lỗi
5599
4859
3498
`to` bỏ " ,4" đi
5599
4859
3498
R test lại
4327
2546
1958
ổn chưa zậy