Program Console Vignaankosh.com
Execution Panel
Console is empty.
3D Array Boundary Elements Sum is an interactive C dry run visualizer from the Multi 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 arr[3][4][5], i, j, k;
int l=3, r=4, c=5;
int sum = 0;
// Initialize
for(i =0;i<l;i++)
for(j =0;j<r;j++)
for(k =0;k<c;k++)
arr[i][j][k] = i*100 + j*10 + k;
// Sum boundary elements
for(i =0;i<l;i++) {
for(j =0;j<r;j++) {
for(k =0;k<c;k++) {
if(i==0 || i==l-1 || j==0 || j==r-1 || k==0 || k==c-1) {
sum += arr[i][j][k];
}
}
}
}
printf("Sum of boundary elements = %d\n", sum);
return 0;
}