luc066.c (1289B)
1 /* 2 * Author : Amit Dutta <amitdutta4255@gmail.com> 3 * Date : 08 Feb 2026 4 * Repo : https://github.com/notamitgamer/bsc 5 * License : MIT License (See the LICENSE file for details) 6 */ 7 8 /* Write a program to add two 6 x 6 matrices. 9 */ 10 11 /* Let Us C, Chap- 14 (Multidimensional Arrays), Qn No.: C(f) */ 12 13 /* This file is auto-generated by a bot. */ 14 /* This code is not compiled; it is for reference only. */ 15 16 17 #include <stdio.h> 18 #include <stdlib.h> 19 20 int main() 21 { 22 int mat1[6][6], mat2[6][6], sum[6][6]; 23 int i, j; 24 25 // Initializing matrices with some values automatically 26 // to avoid asking user to enter 72 numbers. 27 printf("Initializing two 6x6 matrices with sample data...\n"); 28 29 for (i = 0; i < 6; i++) 30 { 31 for (j = 0; j < 6; j++) 32 { 33 mat1[i][j] = i + j; // Example data 34 mat2[i][j] = i * j; // Example data 35 } 36 } 37 38 // Adding matrices 39 for (i = 0; i < 6; i++) 40 { 41 for (j = 0; j < 6; j++) 42 { 43 sum[i][j] = mat1[i][j] + mat2[i][j]; 44 } 45 } 46 47 printf("\nSum of the two 6x6 matrices:\n"); 48 for (i = 0; i < 6; i++) 49 { 50 for (j = 0; j < 6; j++) 51 { 52 printf("%4d ", sum[i][j]); 53 } 54 printf("\n"); 55 } 56 57 return 0; 58 }