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.
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 <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;
}
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
begin
readln(a[i]);
end;
for i:=1 to n do
write(a[i]:4);
readln;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(t);
readln;
end.
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;
}
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;
}
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then t:=t+a[i];
writeln(t);
readln;
end.
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.