Negmatov Ulug’bek 27-variant ++++++++++
1-misol. Foydalanuvchi tomonidan kiritilgan uchta sonning oʻrta arifmetigini ekranga chiqaruvchi dastur tuzing
#include
using namespace std;
int main(float a, float b, float c)
{
float a,b,c,S;
cout<<”ixtiyoriy sonlarni kiriting”<
cout<<”a=”; cin>>a;
cout<<”b=”; cin>>b;
cout<<”c=”; cin>>c;
S=((a+b+c)/3);
cout<<”o’rta arifmetigi “<<”S=”<
system(“pause”);
return 0;
}
2-misol. WHILE siklidan foydalanib y=kx+b, funksiyaning qiymatini x =1, 2, ..., 100 da hisoblang
#include
using namespace std;
int main(float k, float b, float x)
{
float y,b,k;
int x=1;
cout<<”o’zgarmaslarni kiriting ”<
cout<<”k=”; cin>>k;
cout<<”b=”; cin>>b;
while (x<=100)
{
cout<<”y=”<<(k*x+b)<
x++;
}
system(“pause”);
Return 0;
}
Do'stlaringiz bilan baham: |