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.
const fi='hinhtron.inp';
fo='hinhtron.out';
var f1,f2:text;
a:array[1..100]of real;
i,n:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eof(f1) do
begin
n:=n+1;
read(f1,a[n]);
end;
for i:=1 to n do
writeln(f2,'Hinh tron thu ',i,': Chu vi la ',(2*a[n]*pi):4:2,' va Dien tich la: ',a[n]*a[n]*pi:4:2);
close(f1);
close(f2);
end.
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.
#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;
}
Code c:
#include <stdio.h>
#include <conio.h>
#include <math.h>
#define PI 3.14159
int main() {
int r;
float chuvi, dientich;
printf("Nhap ban kinh r:");
scanf("%d", &r);
chuvi = 2*PI*r;
dientich = PI*r*r;
printf("Chu vi hinh tron la: %f\n", chuvi);
printf("Dien tich hinh tron la: %f", dientich);
getch();
BN THAM KHẢO:
Program S_Hinh_Tron;
Uses Crt;
Var r,S:real;
Begin
Clrscr;
Writeln(‘TINH DIEN TICH HINH TRON:’);
Write (‘Nhap ban kinh R=’);readln(r);
dt:=pi*r*r;
Writeln(‘Dien tich hinh tron la:’,dt:6:2);
Readln;
End.