0% found this document useful (0 votes)
16 views3 pages

Programing C Problems

The document contains a series of C programming tasks involving matrix operations, including creating and printing a 2D array, adding and multiplying matrices, finding the sum of right diagonals, calculating the transpose of a matrix, and identifying repeating elements in an array. Each task includes test data and expected output for verification. The tasks are designed to demonstrate fundamental programming concepts related to arrays and matrices.

Uploaded by

victordevilla1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

Programing C Problems

The document contains a series of C programming tasks involving matrix operations, including creating and printing a 2D array, adding and multiplying matrices, finding the sum of right diagonals, calculating the transpose of a matrix, and identifying repeating elements in an array. Each task includes test data and expected output for verification. The tasks are designed to demonstrate fundamental programming concepts related to arrays and matrices.

Uploaded by

victordevilla1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1. Write a program in C for a 2D array of size 3x3 and print the matrix.

Test Data :
Input elements in the matrix :
element - [0],[0] : 1
element - [0],[1] : 2
element - [0],[2] : 3
element - [1],[0] : 4
element - [1],[1] : 5
element - [1],[2] : 6
element - [2],[0] : 7
element - [2],[1] : 8
element - [2],[2] : 9
Expected Output :
The matrix is :

123
456
789

2. Write a program in C for addition of two Matrices of same size.


Test Data :
Input the size of the square matrix (less than 5): 2
Input elements in the first matrix :
element - [0],[0] : 1
element - [0],[1] : 2
element - [1],[0] : 3
element - [1],[1] : 4
Input elements in the second matrix :
element - [0],[0] : 5
element - [0],[1] : 6
element - [1],[0] : 7
element - [1],[1] : 8
Expected Output :
The First matrix is :

12
34
The Second matrix is :

56
78
The Addition of two matrix is :

68
10 12
3. Write a program in C for multiplication
of two square Matrices.
Test Data :
Input the rows and columns of first
matrix : 2 2
Input the rows and columns of second
matrix : 2 2
Input elements in the first matrix :
element - [0],[0] : 1
element - [0],[1] : 2
element - [1],[0] : 3
element - [1],[1] : 4
Input elements in the second matrix :
element - [0],[0] : 5
element - [0],[1] : 6
element - [1],[0] : 7
element - [1],[1] : 8
Expected Output :
The First matrix is :

12
34
The Second matrix is :

56
78
The multiplication of two matrix is :

19 22
43 50

4. Write a program in C to find sum of right diagonals of a matrix.


Test Data :
Input the size of the square matrix : 2
Input elements in the first matrix :
element - [0],[0] : 1
element - [0],[1] : 2
element - [1],[0] : 3
element - [1],[1] : 4
Expected Output :
The matrix is :
12
34
Addition of the right Diagonal elements is :5

5. Write a program in C to find transpose of a given matrix.


Test Data :
Input the rows and columns of the matrix : 2 2
Input elements in the first matrix :
element - [0],[0] : 1
element - [0],[1] : 2
element - [1],[0] : 3
element - [1],[1] : 4
Expected Output :
The matrix is :

12
34

The transpose of a matrix is :


13
24

6. Write a program in C to find the two repeating elements in a given array.


Expected Output :
The given array is : 2 7 4 7 8 3 4
The repeating elements are: 7 4

You might also like