APC-S-012.c (1016B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* Write a program to check if a matrix is a sparx matrix. */ 8 /* Author: Amit Dutta, Date: 19-11-2025 */ 9 10 #include <stdio.h> 11 12 int main() 13 { 14 int i, j, row, col, count = 0; 15 16 printf("Enter the number of rows and columns in the matrix: "); 17 scanf("%d %d", &row, &col); 18 19 int matrix[row][col]; 20 21 for (i = 0; i < row; i++) 22 for (j = 0; j < col; j++) 23 { 24 printf("Postion %d%d: ", i, j); 25 scanf("%d", &matrix[i][j]); 26 if (matrix[i][j] == 0) 27 count++; 28 } 29 30 printf("\nEntered Matrix: \n"); 31 for (i = 0; i < row; i++) 32 { 33 for (j = 0; j < col; j++) 34 printf("%d ", matrix[i][j]); 35 printf("\n"); 36 } 37 38 if (count > (row * col) / 2) 39 printf("\nEntered matrix is a Sparx Matrix."); 40 else 41 printf("\nEntered matrix is not a Sparx Matrix"); 42 return 0; 43 }