0% found this document useful (0 votes)
132 views1 page

A BXC D

The document defines a C program that takes user input for the dimensions of four matrices (A, B, C, D) and then calculates matrix A by multiplying matrices B and C and adding matrix D element-wise, outputting the result.

Uploaded by

Stefan Vukojevic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views1 page

A BXC D

The document defines a C program that takes user input for the dimensions of four matrices (A, B, C, D) and then calculates matrix A by multiplying matrices B and C and adding matrix D element-wise, outputting the result.

Uploaded by

Stefan Vukojevic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include "stdio.

h"
void main()
{
int n, i, j, k, a[20][20], b[20][20],c[20][20],d[20][20];
printf("unesite dimenziju matrice: ");
scanf("%d", &n);

printf("unesite elemente prve matrice: \n");


for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
scanf("%d", &b[i][j]);

printf("unesite elemente druge matrice: \n");


for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
scanf("%d", &c[i][j]);

printf("unesite elemente trece matrice: \n");


for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
scanf("%d", &d[i][j]);

for (i = 0; i < n; i++)


for (j = 0; j < n; j++)
a[i][j] = b[i][j] * c[i][j] + d[i][j];

printf("matrica sada izgleda ovako: ");


for (i = 0; i < n; i++)
{
printf("\n");
for (j = 0; j < n; j++)
printf("%d ", a[i][j]);
}
}

You might also like