Quyidagi masalaning dasturini tuzing:
(Muntazam beshburchak). Foydalanuvchi tomonidan muntazam beshburchakka tashqi chizilgan aylana radiusi kiritilganda, beshburchakning yuzasini hisoblovchi dastur tuzing.
Beshburchak yuzasining formulasi quyidagicha:
Bu yerda S beshburchak tomoni uzunligi bo’lib, quyidagiga teng:
T/r
|
Kiruvchi ma’lumot
|
Chiquvchi ma’lumot
|
1
|
3
|
21.3988
|
2
|
5
|
59.441
|
3
|
10
|
237.764
|
Kode:
#include
#include
using namespace std;
int main()
{
double R,S,pi=M_PI,Yuza;
cout<<"Radiusni kiriting"<std::cin >> R;
S=2*R*sin(pi/5);
Yuza=5*S*S/4*tan(pi/5);
cout<<"S="<cout<<"Yuza="<return 0;
}
R=3
R=5
R=10
Do'stlaringiz bilan baham: |