0% found this document useful (0 votes)
4 views9 pages

CSE Assignment Done

The document contains a series of programming tasks in C, each requiring the implementation of specific functionalities such as counting duplicates, finding maximum and minimum elements, separating odd and even integers, inserting values into an array, adding two matrices, finding the row with the maximum number of 1s, and calculating the sum of the left diagonals of a matrix. Each task includes test data and expected output to guide the implementation. The tasks are designed to enhance understanding of array manipulation and matrix operations in C programming.

Uploaded by

ahonagaming2
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)
4 views9 pages

CSE Assignment Done

The document contains a series of programming tasks in C, each requiring the implementation of specific functionalities such as counting duplicates, finding maximum and minimum elements, separating odd and even integers, inserting values into an array, adding two matrices, finding the row with the maximum number of 1s, and calculating the sum of the left diagonals of a matrix. Each task includes test data and expected output to guide the implementation. The tasks are designed to enhance understanding of array manipulation and matrix operations in C programming.

Uploaded by

ahonagaming2
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/ 9

QUESTION NO : 01

1. Write a program in C to count the total number of duplicate elements in an array.

Test Data :

Input the number of elements to be stored in the array :3


Input 3 elements in the array :
element - 0 : 5
element - 1 : 1
element - 2 : 1

Expected Output :
Total number of duplicate elements found in the array is : 1

Sol n
QUESTION NO : 02

Write a program in C to find the maximum and minimum elements in an array.

Test Data :

Input the number of elements to be stored in the array :3


Input 3 elements in the array :
element - 0 : 45
element - 1 : 25
element - 2 : 21

Expected Output :

Maximum element is : 45
Minimum element is : 21

Sol n
QUESTION NO : 03

Write a program in C to separate odd and even integers into separate arrays.
Test Data:
Input the number of elements to be stored in the array :5
Input 5 elements in the array:
element - 0 : 25
element - 1 : 47
element - 2 : 42
element - 3 : 56
element - 4 : 32

Expected Output :

The Even elements are :


42 56 32
The Odd elements are :
25 47

Sol n
QUESTION NO : 04
Write a program in C to insert values in the array.

Test Data:

Input the size of array : 4


Input 4 elements in the array in ascending order:
element - 0 : 1
element - 1 : 8
element - 2 : 7
element - 3 : 10
Input the value to be inserted : 5
Input the Position, where the value to be inserted :2

Expected Output :

The current list of the array :


1 8 7 10
After Insert the element the new list is :
1 5 8 7 10
Sol n

QUESTION NO :05

Write a program in C for adding two matrices of the 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

Sol n
QUESTION NO :06

Write a program in C to find the row with the maximum number of 1s.

Test Data:

Take a 2D array as input like below:


01011
11111
10010
00000
10001
Expected Output :

The index of row with maximum 1s is: 1

Sol n

QUESTION NO :07
Write a program in C to find the sum of the left 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 left Diagonal elements is : 5

Sol n

You might also like