bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

luc065.c (1283B)


      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 find if a square matrix is symmetric.
      9 */
     10 
     11 /* Let Us C, Chap- 14 (Multidimensional Arrays), Qn No.: C(e) */
     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 mat[10][10], n, i, j;
     23     int is_symmetric = 1;
     24 
     25     printf("Enter the size of the square matrix (max 10): ");
     26     scanf("%d", &n);
     27 
     28     printf("Enter elements of the %dx%d matrix:\n", n, n);
     29     for (i = 0; i < n; i++)
     30     {
     31         for (j = 0; j < n; j++)
     32         {
     33             scanf("%d", &mat[i][j]);
     34         }
     35     }
     36 
     37     // Check for symmetry: mat[i][j] must equal mat[j][i]
     38     for (i = 0; i < n; i++)
     39     {
     40         for (j = 0; j < n; j++)
     41         {
     42             if (mat[i][j] != mat[j][i])
     43             {
     44                 is_symmetric = 0;
     45                 break;
     46             }
     47         }
     48         if (is_symmetric == 0)
     49             break;
     50     }
     51 
     52     if (is_symmetric)
     53         printf("\nThe matrix is Symmetric.\n");
     54     else
     55         printf("\nThe matrix is NOT Symmetric.\n");
     56 
     57     return 0;
     58 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror