Mavzu: Algoritmlarni murakkablik darajalasining tahlili, murakkablik darajasini baholash usullari Reja


Download 61.75 Kb.
bet2/2
Sana01.09.2023
Hajmi61.75 Kb.
#1672116
1   2
Bog'liq
algoritm 2- mi


return 0;
}

4. x=2i+5 ketma-ketlikning 5 ta hadini hisoblab monitorda yozib ko’rsatadigan dastur tuzing.


# include
Int. main ()
{For (int i=0; I < 5; i++)
{Cout << 2i+5 << end;
}Return (0);
}

5. Ax2+Bx+C=0 kvadrat tenglamaning ildizlarini toping.


C++ da dasturu:
#include
#include Int main()
{
float a,b,c,d,x1,x2;
cout<<”a=”;cin>>a;
cout<<”b=”;cin>>b;
cout<<”c=”;cin>>c;
d=b*b-4*a*c;
if (d<0)
cout<<("tenglamaning haqiqiy ildizlari yoq");
if (d>0)
x1=(-b-sqrt(d))/(2*a);
x2=(-b+sqrt(d))/(2*a);
cout <<"x1=" <cout<<"x2=" <if (d=0)
x1=-b/(2*a);
cout <<"x1=" <system("PAUSE");
return 0; 
}

Download 61.75 Kb.

Do'stlaringiz bilan baham:
1   2




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