Uchburchak tomonlari berilgan. Quyidagilar aniqlansin: a balandliklari; b medianalari


Download 45.17 Kb.
Sana16.11.2021
Hajmi45.17 Kb.
#175128
Bog'liq
2-amaliy topshiriqlar


Uchburchak tomonlari berilgan. Quyidagilar aniqlansin:

a) balandliklari; b) medianalari;


a)

#include



#include

using namespace std;



main()

{

float a,b,c,h1,h2,h3,p;



cout<<"Uchburchak tomonlarini kiriting \n a+b>c\na+c>b\nb+c>a\n shartlarni qanotlantirsin!\n";

cout<<"a=";

cin>>a;


cout<<"b=";

cin>>b;


cout<<"c=";

cin>>c;


p=(a+b+c)/2;

cout<<"\nh1 a tomonga tushirilgan balandligi=";

h1=1./a*2*sqrt(p*(p-a)*(p-b)*(p-c));

cout<



cout<<"\nh2 b tomonga tushirilgan balandligi=";

h2=1./b*2*sqrt(p*(p-a)*(p-b)*(p-c));

cout<



cout<<"\nh3 c tomonga tushirilgan balandligi=";

h3=1./c*2*sqrt(p*(p-a)*(p-b)*(p-c));



cout<


}

b)

#include



#include

using namespace std;

main()

{

float a,b,c,m1,m2,m3;



cout<<"Uchburchak tomonlarini kiriting \n a+b>c\na+c>b\nb+c>a\n shartlarni qanotlantirsin!\n";

cout<<"a=";

cin>>a;

cout<<"b=";

cin>>b;

cout<<"c=";

cin>>c;

cout<<"\nm1 a tomonga tushirilgan mediana=";

m1=sqrt(2*(b*b+c*c)-a*a)/2;

cout<

cout<<"\nm2 b tomonga tushirilgan mediana=";

m2=sqrt(2*(a*a+c*c)-b*b)/2;

cout<

cout<<"\nm3 c tomonga tushirilgan mediana=";

m3=sqrt(2*(a*a+b*b)-c*c)/2;

cout<

}


Download 45.17 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling