|
Zbekiston respublikasi axborot texnalogiyalari va kommunikatsiyalarini rivojlantirish vazirligi
|
Sana | 31.12.2021 | Hajmi | 305,87 Kb. | | #234106 |
| Bog'liq Dilnoza
O’ZBEKISTON RESPUBLIKASI AXBOROT TEXNALOGIYALARI
VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI
MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI
Telekommunikatsiya fakulteti
Dasturlash1 fani bo’yicha
Labaratoriya ish
Bajardi: 410-20 guruh talabasi
RAIMBERGANOVA DILNOZA
Tekshirdi: Gulyamova.D
Tug'ilgan sana: 21.12.1997
Toshkent-2020
(31+11)/20=mod(13)
13.
|
={0,5; 1,45; 7;1; -2; -3; 4,5; -0,7} massiv berilgan. Har bir element formulasi yordamida topiladigan , massivini hosil qiling va satr ko‘rinishida chop eting .
|
#include
using namespace std;
int main ()
{
float b[8],z[8]={0.5,1.45,7,1,-2,-3,4.5,-0.7};
for (int i=0;i<8;i++)
{
b[i]=tan(pow(2,z[i]));
}
for (int i=0;i<8;i++)
{
cout<<"b["<
}
return 0;
}
|
N massiviga (4,5;-3,1; 7,8;-5,6;-2,3; 6,8) massivning musbat elementlarini yozing.
|
#include
using namespace std;
int main ()
{
int q=0;
float N[6],Z[6]={4.5,-3.1,7.8,-5.6,-2.3,6.8};
for (int i=0;i<6;i++)
{
if (Z[i]>0)
{
N[q]=Z[i];
q=q+1;
}
}
for (int i=0;i
{
cout<<"N["<
}
return 0;
}
13
|
X(N) va Y(K ) ikkita massiv berilgan. X va Y massivlarining musbat elementlaridan Z massivni tashkil eting. Z massivining maksimal elementini va uning indeksini aniqlang.
|
#include
using namespace std;
int main ()
{
int N,K,q=1,max,t;
cout<<"N = ";cin>>N;
cout<<"K = ";cin>>K;
int X[N],Y[K],Z[N+K];
cout<
max=0;
for (int i=1;i<=N;i++)
{
cout<<"X["<>X[i];
if (X[i]>0)
{
Z[q]=X[i];
if (Z[q]>max)
{
max=Z[q];
t=q;
}
q=q+1;
}
}
for (int i=1;i<=K;i++)
{
cout<<"Y["<>Y[i];
if (Y[i]>0)
{
Z[q]=Y[i];
if (Z[q]>max)
{
max=Z[q];
t=q;
}
q=q+1;
}
}
for (int i=1;i
{
cout<<"Z["<
}
cout<<"Z[] massivning maksimal elementi = "<
return 0;
}
|
X(N) massivi berilgan. Ularni kamayib borish tartibida Y(N) massiviga joylang. X(N), Y(N ) massivlarning modul bo‘yicha eng katta elementining indeksini aniqlang.
|
#include
using namespace std;
int main ()
{
int N,q,max,max1,q1;
cout<<"N = ";cin>>N;
int X[N],Y[N];
max1=0;
for (int i=1;i<=N;i++)
{
cout<<"X["<>X[i];
if (fabs(X[i])>fabs(max1))
{
max1=X[i];
q1=i;
}
}
max=X[1];
for (int i=1;i<=N;i++)
{
for (int j=1;j<=N;j++)
{
if (X[i]>X[j])
{
swap(X[i],X[j]);
}
}
}
cout<
for (int i=1;i<=N;i++)
{
Y[i]=X[i];
cout<<"Y["<
if (fabs(max)
{
max=Y[i];
q=i;
}
}
cout<
13
|
X=(x1,x2,…, xn) massivning xiє[2, 3] shartini qanoatlantiruvchi elementlarini Y=(y1,y2,…, yk) massiviga ketma ket yozing. k shartni qanoatlantiruchi elementlar soni. ni hisoblang.
| |
#include
using namespace std;
int main ()
{
int n,k=1;
cout<<"n = ";cin>>n;
float X[n],Y[n],s=0;
for (int i=1;i<=n;i++)
{
cout<<"X["<>X[i];
if (X[i]>=2 and X[i]<=3)
{
Y[k]=X[i];
k++;
}
}
cout<
for (int i=1;i
{
cout<<"Y["<
s=s+Y[i];
}
cout<<"S = "<
return 0;
}
13
|
Natural n soni va nn o‘lchamli haqiqiy turdagi A matritsa berilgan. Quyidagi formula yordamida A matritsaga teskari matritsasi topilsin:
bu yerda A – berilgan matritsa; E – birlik matritsa; – teskari matritsaning k- yaqinlashishi, . Teskari matritsa berilgan aniqlikda hisoblansin.
|
#include
using namespace std;
int main ()
{
srand(time(NULL));
int A[9][9],s1=0,s2=0,s3=0;
for (int i=0;i<9;i++)
{
for (int j=0;j<9;j++)
{
A[i][j]=rand()%10;
cout<
}
cout<
}
cout<
for (int i=0;i<9;i++)
{
for (int j=0;j<9;j++)
{
if (i==0 or i==8)
{
s1=s1+A[i][j];
}
else if (j==0 or j==8)
{
s1=s1+A[i][j];
}
}
}
cout<<"s1 = "<
cout<
for (int i=0;i<9;i++)
{
for (int j=0;j<9;j++)
{
if (i==j)
{
s2=s2+A[i][j];
}
else if (i+j==8)
{
s2=s2+A[i][j];
}
}
}
cout<<"s2 = "<
cout<
for (int i=0;i<9;i++)
{
for (int j=0;j<9;j++)
{
if ((j>=i and i<=4 and !(i+j>=9)) or (i>=j and i>4 and !(i+j<=7)))
{
s3=s3+A[i][j];
}
}
}
cout<<"s3 = "<
}
Do'stlaringiz bilan baham: |