Posts

Showing posts with the label Matrix Programs

C Program to Find Multiplication of Two Matrices (दो Matrices का गुणा ज्ञात करने का C प्रोग्राम)

Matrix multiplication is the process of multiplying rows of the first matrix by columns of the second matrix. The number of columns in the first matrix must be equal to the number of rows in the second matrix. Matrix Multiplication वह प्रक्रिया है जिसमें पहली Matrix की Rows और दूसरी Matrix के Columns के तत्वों का गुणा करके उनका योग निकाला जाता है। दो Matrices का गुणा तभी संभव है जब पहली Matrix के Columns की संख्या दूसरी Matrix की Rows की संख्या के बराबर हो। In this program, Matrix A has 3 rows and 2 columns (3×2), while Matrix B has 2 rows and 3 columns (2×3). Therefore, the resultant matrix will have 3 rows and 3 columns (3×3). इस प्रोग्राम में Matrix A का आकार 3×2 और Matrix B का आकार 2×3 है। इसलिए गुणा करने के बाद प्राप्त होने वाली Resultant Matrix का आकार 3×3 होगा। C Program #include <stdio.h> #define R1 3 #define C1 2 #define R2 2 #define C2 3 int main() { int a[R1][C1], b[R2][C2]; int m[R1][C2]; int i, j, k; printf("Enter elements of Matrix A:\n"); ...

C Program to Find Sum of Diagonal Elements of a Matrix (Matrix के Diagonal Elements का योग ज्ञात करने का C प्रोग्राम)

The diagonal elements of a square matrix are the elements whose row and column indices are equal. In this program, we calculate the sum of the main diagonal elements of a 3×3 matrix. Square Matrix के मुख्य विकर्ण (Main Diagonal) के वे तत्व होते हैं जिनके Row और Column Index समान होते हैं। इस प्रोग्राम में हम 3×3 Matrix के मुख्य विकर्ण के तत्वों का योग ज्ञात करेंगे। C Program #include <stdio.h> #define R 3 #define C 3 int main() { int a[R][C], sum = 0; int i, j; printf("Enter elements of a Matrix:\n"); for (i = 0; i < R; i++) { for (j = 0; j < C; j++) { printf("Enter A[%d][%d] = ", i, j); scanf("%d", &a[i][j]); } } /* Sum of main diagonal elements */ for (i = 0; i < R; i++) { for (j = 0; j < C; j++) { if (i == j) { sum = sum + a[i][j]; } } } printf("\nSum of diagona...

C Program to Find Transpose of a Matrix (Matrix का Transpose ज्ञात करने का C प्रोग्राम)

The transpose of a matrix is obtained by interchanging its rows and columns. In the transpose matrix, rows become columns and columns become rows. किसी Matrix की Rows को Columns में और Columns को Rows में बदलने पर उसका Transpose प्राप्त होता है। इस प्रोग्राम में हम एक 2×2 Matrix का Transpose ज्ञात करेंगे। C Program #include <stdio.h> #define R 2 #define C 2 int main() { int a[R][C], b[C][R]; int i, j; printf("Enter elements of Matrix A:\n"); for (i = 0; i < R; i++) { for (j = 0; j < C; j++) { printf("Enter A[%d][%d] = ", i, j); scanf("%d", &a[i][j]); } } printf("\nMatrix A is:\n"); for (i = 0; i < R; i++) { for (j = 0; j < C; j++) { printf("%d\t", a[i][j]); } printf("\n"); } /* Finding transpose of Matrix A */ for (i = 0; i < R; i++) { for (j = 0; j ...

C Program to Calculate Subtraction of Two Matrices (दो Matrices का घटाव ज्ञात करने का C प्रोग्राम)

Matrix subtraction is the process of subtracting the corresponding elements of one matrix from another matrix having the same number of rows and columns. Matrix Subtraction वह प्रक्रिया है जिसमें समान Rows और Columns वाली दो Matrices के संगत तत्वों को घटाया जाता है। इस प्रोग्राम में हम दो 2×2 Matrices का घटाव ज्ञात करेंगे। C Program #include <stdio.h> #define R 2 #define C 2 int main() { int a[R][C], b[R][C], sub[R][C]; int i, j; printf("Enter elements of Matrix A:\n"); for (i = 0; i < R; i++) { for (j = 0; j < C; j++) { printf("Enter A[%d][%d] = ", i, j); scanf("%d", &a[i][j]); } } printf("\nEnter elements of Matrix B:\n"); for (i = 0; i < R; i++) { for (j = 0; j < C; j++) { printf("Enter B[%d][%d] = ", i, j); scanf("%d", &b[i][j]); } } /* Subtraction of two matr...

C Program to Calculate Addition of Two Matrices (दो Matrices का जोड़ ज्ञात करने का C प्रोग्राम)

Matrix addition is the process of adding the corresponding elements of two matrices having the same number of rows and columns. Matrix Addition वह प्रक्रिया है जिसमें समान Rows और Columns वाली दो Matrices के संगत तत्वों को जोड़ा जाता है। इस प्रोग्राम में हम दो 2×2 Matrices का जोड़ ज्ञात करेंगे। C Program #include <stdio.h> #define R 2 #define C 2 int main() { int a[R][C], b[R][C], add[R][C]; int i, j; printf("Enter elements of Matrix A:\n"); for (i = 0; i < R; i++) { for (j = 0; j < C; j++) { printf("Enter A[%d][%d] = ", i, j); scanf("%d", &a[i][j]); } } printf("\nEnter elements of Matrix B:\n"); for (i = 0; i < R; i++) { for (j = 0; j < C; j++) { printf("Enter B[%d][%d] = ", i, j); scanf("%d", &b[i][j]); } } /* Addition of two matrices */ for (i = 0; i < R...