Open-Source-Contributors-JSS / Hacktoberfest2019

Happy Hacktober! :octocat: This is a beginner friendly repository made specifically for Hacktoberfest that helps you get your first PR.
https://hacktoberfest.netlify.com/
GNU General Public License v3.0
403 stars 1.03k forks source link

Hacktoberfest 2023 #1244

Open 17AnuragMishra opened 7 months ago

17AnuragMishra commented 7 months ago

Fill up only the relevant details and skip or remove the rest.

Prerequisites

Please answer the following questions for yourself before submitting an issue.

YOU MAY DELETE THE PREREQUISITES SECTION.

Matrices-multiply-program-in-c-is-missing.

//here is the code-

include

int main(void) { int i, j, k, p, q, m = 0, n = 0, final = 0; int fst[m][n], sec[m][n], mul[m][n];

printf(" Write the number of rows and columns for first matrix \n ");
scanf("%d%d", &m, &n);

printf(" Insert your matrix elements : \n ");
for (i = 0; i < m; i++)
    for (j = 0; j < n; j++) {
        scanf("%d", &fst[i][j]);
    }

printf(" Write the number of rows and columns for second matrix\n");
scanf(" %d %d", &p, &q);

if (n != p)
    printf(" Matrices cannot be multiplied with each other. \n ");
else
{
    printf(" Insert your elements for second matrix \n ");

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

    for (i = 0; i < m; i++) {
        for (j = 0; j < q; j++) {
            for (k = 0; k < p; k++) {
                final = final + fst[i][k] * sec[k][j];
            }
            mul[i][j] = final;
            final = 0;
        }
    }

    printf(" Matrix multiplication or product of the matrices is: \n ");
    for (i = 0; i < m; i++) {
        for (j = 0; j < q; j++)
            printf("%d \t", mul[i][j] );
        printf(" \n ");
    }
}
return 0;

}

ShreyaSarkar10 commented 7 months ago

Helllo @17AnuragMishra , i want to work on this issue. kindly assign me.

AnitaSahoo2002 commented 7 months ago

How to run this project locally?

SkyePh commented 2 months ago

How to run this project locally?

execute the following code in your git bash terminal:

git clone {the url of the repo}