Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a program to read and display a 2D matrix.

Hard

Problem Statement

Create a program to read and display a 2D matrix.

Sample Input

int matrix[2][3] = {{1, 2, 3}, {4, 5, 6}};

Sample Output

1 2 3 
4 5 6 

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
#include <iostream> void displayMatrix(int matrix[][3], int rows, int cols); int main() { // Logic to demonstrate matrix display return 0; }
Log in or sign up to run or submit your code.Log inSign up
Input
int matrix[2][3] = {{1, 2, 3}, {4, 5, 6}};
Expected Output
1 2 3 
4 5 6