SlideShare a Scribd company logo
2
Most read
Array and Matrix programming exercises and solutions in
C
Rumman Ansari www.atnyla.com
Array is a linear data structure that hold finite sequential collection of
homogeneous data. We can store a collection of values in an array.
Array uses an integer value index to access a specific element. Index starts
from 0 and goes till N-1 (where N is the size of array).
Array and variable representation in memory
Arrays are divided in two categories.
 One-dimensional array
 Multi-dimensional array
In this exercise we will focus on one-dimensional and multi-dimensional
array. We will learn to implement and use arrays in programming.
Always feel free to drop your queries and suggestions down in the comments
section. I always love to hear from atnyla lovers.
Required knowledge
Basic C programming, Loop, Recursion, Arrays, Multi-dimensional array
List of array and matrix programming exercises
1. Write a C program to read and print elements of array. - using recursion.
2. Write a C program to print all negative elements in an array.
3. Write a C program to find sum of all array elements. - using recursion.
4. Write a C program to find maximum and minimum element in an array. -
using recursion.
5. Write a C program to find second largest element in an array.
6. Write a C program to count total number of even and odd elements in an
array.
7. Write a C program to count total number of negative elements in an array.
8. Write a C program to copy all elements from an array to another array.
9. Write a C program to insert an element in an array.
10. Write a C program to delete an element from an array at specified position.
11. Write a C program to count frequency of each element in an array.
12. Write a C program to print all unique elements in the array.
13. Write a C program to count total number of duplicate elements in an array.
14. Write a C program to delete all duplicate elements from an array.
15. Write a C program to merge two array to third array.
16. Write a C program to find reverse of an array.
17. Write a C program to put even and odd elements of array in two separate
array.
18. Write a C program to search an element in an array.
19. Write a C program to sort array elements in ascending or descending order.
20.Write a C program to sort even and odd elements of array separately.
21. Write a C program to left rotate an array.
22. Write a C program to right rotate an array.
List of matrix programming exercises
23.Write a C program to add two matrices.
24.Write a C program to subtract two matrices.
25.Write a C program to perform Scalar matrix multiplication.
26.Write a C program to multiply two matrices.
27. Write a C program to check whether two matrices are equal or not.
28.Write a C program to find sum of main diagonal elements of a matrix.
29.Write a C program to find sum of minor diagonal elements of a matrix.
30.Write a C program to find sum of each row and column of a matrix.
31. Write a C program to interchange diagonals of a matrix.
32.Write a C program to find upper triangular matrix.
33.Write a C program to find lower triangular matrix.
34.Write a C program to find sum of upper triangular matrix.
35.Write a C program to find sum of lower triangular matrix.
36.Write a C program to find transpose of a matrix.
37. Write a C program to find determinant of a matrix.
38.Write a C program to check Identity matrix.
39.Write a C program to check Sparse matrix.
40.Write a C program to check Symmetric matrix.

More Related Content

What's hot (19)

PPTX
WolframAlpha Examples part 4
Colleen Young
 
PPTX
WolframAlpha matrices
Colleen Young
 
PPT
Int alg 3.1 notes
Nikki
 
PPTX
WolframAlpha Examples part 3
Colleen Young
 
PPTX
WolframAlpha Examples part 2
Colleen Young
 
DOC
Comp 122 lab 3 lab report and source code
pradesigali1
 
PPTX
WolframAlpha - KS3 part 1
Colleen Young
 
PDF
practice problems on functions IN SWIFT
LOVELY PROFESSIONAL UNIVERSITY
 
PDF
Programming C Part 02
Raselmondalmehedi
 
PDF
Program to be written for C Output: program to compute e. The calculation of...
hwbloom8
 
PDF
AP Calculus January 13, 2009
Darren Kuropatwa
 
PDF
Write a Java program Lab42.java: implement a superclass Account with the prot...
hwbloom34
 
DOCX
Risk severity level extraction
Juha Salenius
 
PDF
Lecture 3
Tanveer Malik
 
PPTX
Relational operators
Graphic Era Hill University,Bhimtal
 
PDF
R operators
Learnbay Datascience
 
PPTX
Yasar University Linear Algebra Calculator
Yusuf Yasin Kumbul
 
DOCX
Cis 355 i lab 3 of 6
helpido9
 
PPTX
Python operators
nuripatidar
 
WolframAlpha Examples part 4
Colleen Young
 
WolframAlpha matrices
Colleen Young
 
Int alg 3.1 notes
Nikki
 
WolframAlpha Examples part 3
Colleen Young
 
WolframAlpha Examples part 2
Colleen Young
 
Comp 122 lab 3 lab report and source code
pradesigali1
 
WolframAlpha - KS3 part 1
Colleen Young
 
practice problems on functions IN SWIFT
LOVELY PROFESSIONAL UNIVERSITY
 
Programming C Part 02
Raselmondalmehedi
 
Program to be written for C Output: program to compute e. The calculation of...
hwbloom8
 
AP Calculus January 13, 2009
Darren Kuropatwa
 
Write a Java program Lab42.java: implement a superclass Account with the prot...
hwbloom34
 
Risk severity level extraction
Juha Salenius
 
Lecture 3
Tanveer Malik
 
Yasar University Linear Algebra Calculator
Yusuf Yasin Kumbul
 
Cis 355 i lab 3 of 6
helpido9
 
Python operators
nuripatidar
 

Similar to C programming exercises and solutions (20)

PDF
Array
SANTOSH RATH
 
PDF
Array sheet
Mahmoud Abuelmagd
 
PDF
SPL 10 | One Dimensional Array in C
Mohammad Imam Hossain
 
PDF
Cunit3.pdf
zeenatparveen24
 
DOC
Basic c programs updated on 31.8.2020
vrgokila
 
DOCX
C programs
vijaybandi36
 
DOCX
Programming questions
Dr.Subha Krishna
 
PDF
1D Array
A. S. M. Shafi
 
PPTX
ppt on arrays in c programming language.pptx
AmanRai352102
 
PDF
CP PPT_Unit IV computer programming in c.pdf
saneshgamerz
 
PPT
All important c programby makhan kumbhkar
sandeep kumbhkar
 
PDF
Unit 4
SHIKHA GAUTAM
 
PDF
C_Dayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 5.pdf
amanpathak160605
 
PPTX
ARRAY in python and c with examples .pptx
abhishekmaurya102515
 
PPT
array.ppt
DeveshDewangan5
 
DOCX
Chapter 8 c solution
Azhar Javed
 
PPTX
C_Arrays.pptx
Debasis Dwibedy
 
PPTX
Arrays.pptx
saimasiddique11
 
PDF
Common problems solving using c
ArghodeepPaul
 
PPTX
Examples sandhiya class'
Dr.Sandhiya Ravi
 
Array sheet
Mahmoud Abuelmagd
 
SPL 10 | One Dimensional Array in C
Mohammad Imam Hossain
 
Cunit3.pdf
zeenatparveen24
 
Basic c programs updated on 31.8.2020
vrgokila
 
C programs
vijaybandi36
 
Programming questions
Dr.Subha Krishna
 
1D Array
A. S. M. Shafi
 
ppt on arrays in c programming language.pptx
AmanRai352102
 
CP PPT_Unit IV computer programming in c.pdf
saneshgamerz
 
All important c programby makhan kumbhkar
sandeep kumbhkar
 
C_Dayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 5.pdf
amanpathak160605
 
ARRAY in python and c with examples .pptx
abhishekmaurya102515
 
array.ppt
DeveshDewangan5
 
Chapter 8 c solution
Azhar Javed
 
C_Arrays.pptx
Debasis Dwibedy
 
Arrays.pptx
saimasiddique11
 
Common problems solving using c
ArghodeepPaul
 
Examples sandhiya class'
Dr.Sandhiya Ravi
 
Ad

More from Rumman Ansari (20)

PDF
Sql tutorial
Rumman Ansari
 
PDF
Java Tutorial best website
Rumman Ansari
 
DOCX
Java Questions and Answers
Rumman Ansari
 
DOCX
servlet programming
Rumman Ansari
 
PPTX
C program to write c program without using main function
Rumman Ansari
 
PPTX
Steps for c program execution
Rumman Ansari
 
PPTX
Pointer in c program
Rumman Ansari
 
PPTX
My first program in c, hello world !
Rumman Ansari
 
PPTX
How c program execute in c program
Rumman Ansari
 
PPTX
What is token c programming
Rumman Ansari
 
PPTX
What is identifier c programming
Rumman Ansari
 
PPTX
What is keyword in c programming
Rumman Ansari
 
PPTX
Type casting in c programming
Rumman Ansari
 
PPTX
C Programming Language Part 11
Rumman Ansari
 
PPTX
C Programming Language Part 9
Rumman Ansari
 
PPTX
C Programming Language Part 8
Rumman Ansari
 
PPTX
C Programming Language Part 7
Rumman Ansari
 
PPTX
C Programming Language Part 6
Rumman Ansari
 
PPTX
C Programming Language Part 5
Rumman Ansari
 
PPTX
C Programming Language Part 4
Rumman Ansari
 
Sql tutorial
Rumman Ansari
 
Java Tutorial best website
Rumman Ansari
 
Java Questions and Answers
Rumman Ansari
 
servlet programming
Rumman Ansari
 
C program to write c program without using main function
Rumman Ansari
 
Steps for c program execution
Rumman Ansari
 
Pointer in c program
Rumman Ansari
 
My first program in c, hello world !
Rumman Ansari
 
How c program execute in c program
Rumman Ansari
 
What is token c programming
Rumman Ansari
 
What is identifier c programming
Rumman Ansari
 
What is keyword in c programming
Rumman Ansari
 
Type casting in c programming
Rumman Ansari
 
C Programming Language Part 11
Rumman Ansari
 
C Programming Language Part 9
Rumman Ansari
 
C Programming Language Part 8
Rumman Ansari
 
C Programming Language Part 7
Rumman Ansari
 
C Programming Language Part 6
Rumman Ansari
 
C Programming Language Part 5
Rumman Ansari
 
C Programming Language Part 4
Rumman Ansari
 
Ad

Recently uploaded (20)

PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 

C programming exercises and solutions

  • 1. Array and Matrix programming exercises and solutions in C Rumman Ansari www.atnyla.com Array is a linear data structure that hold finite sequential collection of homogeneous data. We can store a collection of values in an array. Array uses an integer value index to access a specific element. Index starts from 0 and goes till N-1 (where N is the size of array). Array and variable representation in memory Arrays are divided in two categories.  One-dimensional array  Multi-dimensional array In this exercise we will focus on one-dimensional and multi-dimensional array. We will learn to implement and use arrays in programming. Always feel free to drop your queries and suggestions down in the comments section. I always love to hear from atnyla lovers. Required knowledge Basic C programming, Loop, Recursion, Arrays, Multi-dimensional array
  • 2. List of array and matrix programming exercises 1. Write a C program to read and print elements of array. - using recursion. 2. Write a C program to print all negative elements in an array. 3. Write a C program to find sum of all array elements. - using recursion. 4. Write a C program to find maximum and minimum element in an array. - using recursion. 5. Write a C program to find second largest element in an array. 6. Write a C program to count total number of even and odd elements in an array. 7. Write a C program to count total number of negative elements in an array. 8. Write a C program to copy all elements from an array to another array. 9. Write a C program to insert an element in an array. 10. Write a C program to delete an element from an array at specified position. 11. Write a C program to count frequency of each element in an array. 12. Write a C program to print all unique elements in the array. 13. Write a C program to count total number of duplicate elements in an array. 14. Write a C program to delete all duplicate elements from an array. 15. Write a C program to merge two array to third array. 16. Write a C program to find reverse of an array. 17. Write a C program to put even and odd elements of array in two separate array. 18. Write a C program to search an element in an array. 19. Write a C program to sort array elements in ascending or descending order. 20.Write a C program to sort even and odd elements of array separately. 21. Write a C program to left rotate an array. 22. Write a C program to right rotate an array. List of matrix programming exercises 23.Write a C program to add two matrices. 24.Write a C program to subtract two matrices. 25.Write a C program to perform Scalar matrix multiplication. 26.Write a C program to multiply two matrices. 27. Write a C program to check whether two matrices are equal or not. 28.Write a C program to find sum of main diagonal elements of a matrix. 29.Write a C program to find sum of minor diagonal elements of a matrix. 30.Write a C program to find sum of each row and column of a matrix. 31. Write a C program to interchange diagonals of a matrix. 32.Write a C program to find upper triangular matrix. 33.Write a C program to find lower triangular matrix. 34.Write a C program to find sum of upper triangular matrix. 35.Write a C program to find sum of lower triangular matrix. 36.Write a C program to find transpose of a matrix. 37. Write a C program to find determinant of a matrix. 38.Write a C program to check Identity matrix. 39.Write a C program to check Sparse matrix. 40.Write a C program to check Symmetric matrix.