1-lobarotoriya
Kvadrat tenglamaning ildizlarini topish
9-misol
1.Koeffitsiyentlari a=1, b= 8, c=7bo’lgankvadrattenglamaildizlaritopilsin;
Algoritmi va dastur kodi
#include
#include
using namespace std;
int main()
{
int a,b,c;
double d,x1, x2;
cin>>a>>b>>c;
d=sqrt(b*b-4*a*c);
cout<if(d<0)
{cout<<"yechimga ega emas";}
if(d>0)
{
x1=(-b-(d))/(2*a);
x2=(-b+(d))/(2*a);
cout<
}}
2.Tomonlari a=12, b=15, c=9 bo’lgan uchburchak yuzi topilsin.
#include
#include
using namespace std;
int main()
{
double a,b,c, D;
cin>>a>>b>>c;
double x1,x2;
D=sqrt(b*b-4*a*c);
if (D>0) {
x1=-b-sqrt(D)/(2*a);
x2=-b+sqrt(D)/(2*a);
cout<}
else {
if (D<0)
{cout <<"Diskriminat 0 dan kichik";}
else {
x1=-b+sqrt(D)/2*a;
cout<}
}
Do'stlaringiz bilan baham: |