Ma’lumotlar tuzilmasi va algoritmi F. I. Sh. Akmalbek Jumaniyozov Guruh: 911-21 Amaliyot: 1-amaliyot Misol: 8-savol Dasturlash tili: C++ Savol


Download 79.11 Kb.
Sana24.12.2022
Hajmi79.11 Kb.
#1055160
Bog'liq
1-Amaliyot


Ma’lumotlar tuzilmasi va algoritmi
F.I.SH._Akmalbek Jumaniyozov
Guruh: 911-21
Amaliyot: 1-amaliyot
Misol: 8-savol
Dasturlash tili: C++


Savol: Matritsani matritsaga ko‘paytiring.

#include


using namespace std;

void MultiplyWithOutAMP() {


int a[3][2] = {{1, 4}, {2, 5}, {3, 6}};
int b[2][3] = {{7, 8, 9}, {10, 11, 12}};
int product[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};

for (int row = 0; row < 3; row++) {


for (int col = 0; col < 3; col++) {
// Mahsulot satrini, ustunini olish uchun A qatorni B ustunga ko'paytirish.
for (int inner = 0; inner < 2; inner++) {
product[row][col] += a[row][inner] * b[inner][col];
}
std::cout << product[row][col] << " ";
}
std::cout << "\n";
}
}

int main() {


MultiplyWithOutAMP();
getchar();

return 0;


}



Download 79.11 Kb.

Do'stlaringiz bilan baham:




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