Topshiriqlar variantlari


Download 13.01 Kb.
Sana31.01.2024
Hajmi13.01 Kb.
#1832575
Bog'liq
Rixsiboyev Samandar 3-mustaqil ish


Topshiriqlar variantlari
5-variant.
1-msol.

Misol Kõdning kõrinishi.
#include
using namespace std;
int main()
{
int n;
cout << "n = ";
cin >> n;
int* h = new int [n];
double avg = 0, p = 1;
for(int i = 0; i < n; i++)
{
cin >> h[i];
avg += h[i];
}
avg /= n;
for(int i = 0; i < n; i++)
if(h[i] < avg)
p *= h[i];
cout << "Ko'paytmasi: " << p << endl;
delete [] h;
return 0;
}
Misolning dasturdagi kõrinishi.

Misolning natijasi.

2-msol.

Misol kodning kõrinishi.
#include
#include
#include
using namespace std;
int main()
{
srand(time(0));
int A[10][10], B[9][9];
int n, k, I = 0, J;
for(int i = 0; i < 10; i++)
{
for(int j = 0; j < 10; j++)
{
A[i][j] = rand() % 10;
cout << A[i][j] << ' ';
}
cout << endl;
}
cout << "\nn = "; cin >> n;
cout << "k = "; cin >> k;
for(int i = 0; i < 10; i++)
{
if(i != n - 1)
{
J = 0;
for(int j = 0; j < 10; j++)
{
if(j != k - 1)
B[I][J++] = A[i][j];
}
I++;
}
}
for(int i = 0; i < 9; i++)
{
for(int j = 0; j < 9; j++)
{
cout << B[i][j] << ' ';
}
cout << endl;
}
return 0;}
Misolning dasturdagi kõrinishi.

Misolning natijasi.

Download 13.01 Kb.

Do'stlaringiz bilan baham:




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