Program Console Vignaankosh.com
Execution Panel
Console is empty.
Saddle Point of Matrix (Smallest in Row, Largest in Column) is an interactive C dry run visualizer from the Two D programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.
This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.
#include <stdio.h>
int main() {
int matrix[3][3] = {{6, 3, 1}, {9, 7, 8}, {2, 4, 5}}, i, j, k;
int saddleFound = 0;
for(i = 0; i < 3; i++) {
// Find minimum in row i
int rowMin = matrix[i][0];
int minCol = 0;
for(j = 1; j < 3; j++) {
if(matrix[i][j] < rowMin) {
rowMin = matrix[i][j];
minCol = j;
}
}
// Check if rowMin is maximum in its column
int isMax = 1;
for(k = 0; k < 3; k++) {
if(matrix[k][minCol] > rowMin) {
isMax = 0;
break;
}
}
if(isMax) {
printf("Saddle point found at (%d,%d) = %d\n", i, minCol, rowMin);
saddleFound = 1;
}
}
if(!saddleFound)
printf("No saddle point found\n");
return 0;
}