Yechimi: Pascal tilida


Download 46.47 Kb.
bet3/4
Sana09.06.2023
Hajmi46.47 Kb.
#1476130
1   2   3   4
Bog'liq
Begin

Yechimi:

Pascal tilida

program begin20;
uses crt;
var
C,x1,x2,y1,y2:real;
begin
writeln('Ikkita nuqta koordinatalarini kiriting:');
write('x1='); read(x1);
write('x2='); read(x2);
write('y1='); read(y1);
write('y2='); read(y2);
C:=sqrt(sqr(x2-x1)+sqr(y2-y1));
write('Ikki nuqta orasidagi masofa = ', C:0:2);
readkey;
end.

C++ tilida


#include


#include
#include
int main()
{
float x1,x2,y1,y2;
cout<<"Ikkita nuqta koordinatalarini kiriting:\n";
cout<<"x1 = "; cin>>x1;
cout<<"x2 = "; cin>>x2;
cout<<"y1 = "; cin>>y1;
cout<<"y2 = "; cin>>y2;
float C=sqrt(pow(x2-x1,2)+pow(y2-y1,2));
cout<<"Ikki nuqta orasidagi masofa = "<getch();
}

Begin21. Uchburchakning uchta tomoni uchlari koordinatlari berilgan (x1,y1), (x2,y2), (x3,y3) ikki nuqta orasidagi masofani topish . Uchburchakning yuzasini va perimatrini toping. p=(a+b+c)/2




Yechimi:

Pascal tilida


C++ tilida


#include


#include
#include
int main()
{
float x1,x2,x3,y1,y2,y3;
cout<<"Ikkita nuqta koordinatalarini kiriting:\n";
cout<<"x1 = "; cin>>x1;
cout<<"y1 = "; cin>>y1;
cout<<"x2 = "; cin>>x2;
cout<<"y2 = "; cin>>y2;
cout<<"x3 = "; cin>>x3;
cout<<"y3 = "; cin>>y3;
float a=sqrt(pow(x2-x1,2)+pow(y2-y1,2));
float b=sqrt(pow(x2-x3,2)+pow(y2-y3,2));
float c=sqrt(pow(x3-x1,2)+pow(y3-y1,2));
float p=(a+b+c)/2;
float s=sqrt(p*(p-a)*(p-b)*(p-c));
cout<<"Uchburchakning yuzi = "<getch();
}
Begin22. Berilgan A va В sonlarining qiymatlarini almashtiring. A va В ning yangi qiymati ekranga chiqarilsin.



Download 46.47 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




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