Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
#include <iostream>
#include <iomanip>
int main() {
int r;
std::cin >> r;
double pi = 3.14;
double perimeter = 2 * pi * r;
double area = pi * r * r;
std::cout << std::fixed << std::setprecision(2);
std::cout << "p= " << perimeter << std::endl;
std::cout << "s= " << area << std::endl;
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int r;
const float Pi = 3.14;
cout << "Nhap ban kinh hinh tron: ";
cin >> r;
float chu_vi = 2 * Pi * r;
float dien_tich = Pi * r * r;
cout << fixed << setprecision(2);
cout << "p= " << chu_vi << endl;
cout << "s= " << dien_tich << endl;
return 0;
}
2:
#include <bits/stdc++.h>
using namespace std;
double a,b,c,p,s;
int main()
{
cin>>a>>b>>c;
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
cout<<fixed<<setprecision(2)<<s;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
double a,b,c,p,s;
int main()
{
cin>>a>>b>>c;
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
cout<<"Chu vi la:"<<fixed<<setprecision(2)<<p*2<<endl;
cout<<"Dien tich la:"<<fixed<<setprecision(2)<<s;
return 0;
}
Bài 5:
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<(a+b)*2;
return 0;
}
Tham khảo
program hcn;
uses crt;
var d,r,dt:longint;
cv:real;
begin
write('nhap chieu dai va chieu rong cua hcn:');
readln(d,r);
cv:=(d+r)*2;
dt:=d*r;
writeln(' chu vi hcn do la:',cv);
writeln(' dien tich hcn do la:',dt);
readln
end.
program TinhDienTichHinhTron;
var
fIn, fOut: Text;
r: Integer;
dien_tich: Real;
begin
Assign(fIn, 'dt_ht.inp');
Reset(fIn);
Readln(fIn, r);
Close(fIn);
Assign(fOut, 'dt_ht.out');
Rewrite(fOut);
dien_tich := Pi * r * r;
Writeln(fOut, FormatFloat('0.00', dien_tich));
Close(fOut);
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
double r,cv,s;
cin>>r;
cv=(2*r)*pi;
cout<<fixed<<setprecision(2)<<cv<<endl;
dt=sqr(r)*pi;
cout<<fixed<<setprecsion(2)<<dt<<endl;
return 0;
}