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;
}
Do'stlaringiz bilan baham: |