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

Programming Exercises

Find the largest element in each row of a 2x3 matrix {{3, 5, 1}, {7, 2, 8}}.

Medium

Problem Statement

Find the largest element in each row of a 2x3 matrix {{3, 5, 1}, {7, 2, 8}}.

Sample Input

Matrix:
 3 5 1
 7 2 8

Sample Output

Max element in row 1: 5
Max element in row 2: 8

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
#include <stdio.h> void maxInRows(int matrix[2][3]) { // Your code here } int main() { int matrix[2][3] = {{3, 5, 1}, {7, 2, 8}}; maxInRows(matrix); return 0; }
Log in or sign up to run or submit your code.Log inSign up
Input
Matrix:
 3 5 1
 7 2 8
Expected Output
Max element in row 1: 5
Max element in row 2: 8