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.
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 tich_chu_vi_dien_tich_hinh_tron;
uses crt; //Khai bao thu vien
var r,dien_tich,chu_vi:real; //Khai bao bien
begin
clrscr;
//Input:
write(‘Nhap ban kinh: ‘);readln(r);
//Output:
chu_vi:=r*2*pi;
dien_tich:=r*r*pi;
writeln(‘Chu vi: ‘,chu_vi:0:5);
writeln(‘Dien tich: ‘,dien_tich:0:5);
readln
end.
uses crt;
var a,b,c,p,s:real;
begin
clrscr;
repeat
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
write('Nhap c='); readln(c);
until (a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a);
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln(s:4:2);
readln;
end.
uses crt;
var d,r,cv,dt:real;
begin
clrscr;
readln(d);
r:=d/2;
cv:=d*pi;
dt:=r*r*pi;
writeln(cv:4:2);
writeln(dt:4:2);
readln;
end.
#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;
}
#include <bits/stdc++.h>
using namespace std;
double a;
int main()
{
cin>>a;
cout<<fixed<<setprecision(2)<<a*a;
return 0;
}
var a,b,c,p,s: real;
begin
writeln('NHAP BA CANH TAM GIAC: ');
repeat
write('a = '); readln(a);
write('b = '); readln(b);
write('c = '); readln(c);
until (a+b>c) and (b+c>a) and (c+a>b);
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln('Chu vi tam giac: ',2*p:5:2);
writeln('Dien tich tam giac: ',s:5:2);
writeln('Ban kinh duong tron ngoai tiep: ',a*b*c/(4*s):5:2);
writeln('Ban kinh duong tron noi tiep: ',s/p:5:2);
end.