Baxtiyorov Humoyun:
Mavzu: Algoritmlarni loyihalash kvadrat kvadrat tengla ildizlarini topish. uchburchak yuzi uchun geron
formulasi:
Geron formulasi algaritmi
#include
#include
using namespace std;
int main()
{
float a, b ,c, p;
double s;
cout<<" uchburchak tomonlarini kiriting: " <cout<<"a= ";
cin>>a;
cout<<"b= ";
cin>>b;
cout<<"c= ";
cin>>c;
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
cout<<"uchburchakning yuzi ";
cout<return 0;
}
Kvadrat tenglama
#include
#include
using namespace std;
int main()
{
float a, b ,c, x1, x2;
double D;
cout<<" kvadrat tenglama kaefsenlarini kiriting: " <
cout<<"a= ";
cin>>a;
cout<<"b= ";
cin>>b;
cout<<"c= ";
cin>>c;
D=b*b-4*a*c;
x1=(-b+sqrt(D))/2*a;
x2=(-b-sqrt(D))/2*a;
if(D>0){ cout<<" kvadrat tenglama 2 ta yechimga ega: "<
else if(D=0){ cout<<"kvadrat tenglama 1 ta yechimga ega:"; cout<<"x1="<
else {"kvadrat tenglama yechimga ega emas"; cout<<"x1="<
return 0;
}
Do'stlaringiz bilan baham: |