Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Lab 06

Tasks: 01
Write a program to create a 2D array of size 3x3. The program takes input for each cell in the array and
then calculates and displays the sum of each row.

For example:

123

456

789

 Sum of first row is 6


 Sum of second row is 15
 Sum of third row would is 24

Tasks: 02
Write a program that takes a 3x3 matrix as input and asks for a number entered and prints out its
position in the matrix. It displays not found if the number is not in the matrix.

For example:

123

456

789

Input Example 1:

Enter a number to find: 4

Found! Position: [1] [0]


Input Example 2:

Enter a number to find: 0

Not Found

Tasks: 03
Write a program which calculates the transpose of a 3x3 matrix.

Example:

123

456

789

Transpose:

147

258

369

You might also like