SlideShare a Scribd company logo
1 of 2
Download to read offline
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

Int alg 3.1 notes
Int alg 3.1 notesInt alg 3.1 notes
Int alg 3.1 notes
Nikki
 
WolframAlpha Examples part 3
WolframAlpha Examples part 3WolframAlpha Examples part 3
WolframAlpha Examples part 3
Colleen Young
 
WolframAlpha Examples part 2
WolframAlpha Examples part 2WolframAlpha Examples part 2
WolframAlpha Examples part 2
Colleen Young
 
WolframAlpha - KS3 part 1
WolframAlpha - KS3 part 1WolframAlpha - KS3 part 1
WolframAlpha - KS3 part 1
Colleen Young
 
Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6
helpido9
 

What's hot (20)

WolframAlpha Examples part 4
WolframAlpha Examples part 4WolframAlpha Examples part 4
WolframAlpha Examples part 4
 
WolframAlpha matrices
WolframAlpha matricesWolframAlpha matrices
WolframAlpha matrices
 
Int alg 3.1 notes
Int alg 3.1 notesInt alg 3.1 notes
Int alg 3.1 notes
 
WolframAlpha Examples part 3
WolframAlpha Examples part 3WolframAlpha Examples part 3
WolframAlpha Examples part 3
 
WolframAlpha Examples part 2
WolframAlpha Examples part 2WolframAlpha Examples part 2
WolframAlpha Examples part 2
 
Comp 122 lab 3 lab report and source code
Comp 122 lab 3 lab report and source codeComp 122 lab 3 lab report and source code
Comp 122 lab 3 lab report and source code
 
WolframAlpha - KS3 part 1
WolframAlpha - KS3 part 1WolframAlpha - KS3 part 1
WolframAlpha - KS3 part 1
 
practice problems on functions IN SWIFT
practice problems on functions IN SWIFTpractice problems on functions IN SWIFT
practice problems on functions IN SWIFT
 
Programming C Part 02
Programming C Part 02Programming C Part 02
Programming C Part 02
 
Program to be written for C Output: program to compute e. The calculation of...
Program to be written for C  Output: program to compute e. The calculation of...Program to be written for C  Output: program to compute e. The calculation of...
Program to be written for C Output: program to compute e. The calculation of...
 
AP Calculus January 13, 2009
AP Calculus January 13, 2009AP Calculus January 13, 2009
AP Calculus January 13, 2009
 
Write a Java program Lab42.java: implement a superclass Account with the prot...
Write a Java program Lab42.java: implement a superclass Account with the prot...Write a Java program Lab42.java: implement a superclass Account with the prot...
Write a Java program Lab42.java: implement a superclass Account with the prot...
 
Risk severity level extraction
Risk severity level extractionRisk severity level extraction
Risk severity level extraction
 
java operators
 java operators java operators
java operators
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Relational operators
Relational operatorsRelational operators
Relational operators
 
R operators
R   operatorsR   operators
R operators
 
Yasar University Linear Algebra Calculator
Yasar University Linear Algebra CalculatorYasar University Linear Algebra Calculator
Yasar University Linear Algebra Calculator
 
Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6
 
Python operators
Python operatorsPython operators
Python operators
 

Similar to C programming exercises and solutions

Practical java
Practical javaPractical java
Practical java
nirmit
 
Crack the interview
Crack the interviewCrack the interview
Crack the interview
serenesravan
 
Crack the interview
Crack the interviewCrack the interview
Crack the interview
srb2107
 
Crack the interview
Crack the interviewCrack the interview
Crack the interview
venu0206
 
Develop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdfDevelop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdf
leventhalbrad49439
 

Similar to C programming exercises and solutions (20)

Programming questions
Programming questionsProgramming questions
Programming questions
 
Programming Practice Questions_C
Programming Practice Questions_CProgramming Practice Questions_C
Programming Practice Questions_C
 
Arrays.pdf
Arrays.pdfArrays.pdf
Arrays.pdf
 
Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdf
 
Practical java
Practical javaPractical java
Practical java
 
Arrays with Numpy, Computer Graphics
Arrays with Numpy, Computer GraphicsArrays with Numpy, Computer Graphics
Arrays with Numpy, Computer Graphics
 
Array sheet
Array sheet Array sheet
Array sheet
 
Crack the interview
Crack the interviewCrack the interview
Crack the interview
 
Crack the interview
Crack the interviewCrack the interview
Crack the interview
 
Crack the interview
Crack the interviewCrack the interview
Crack the interview
 
Crack the interview
Crack the interviewCrack the interview
Crack the interview
 
Java conceptual learning material
Java conceptual learning materialJava conceptual learning material
Java conceptual learning material
 
Cse cpl manual-2016
Cse cpl manual-2016Cse cpl manual-2016
Cse cpl manual-2016
 
C_Lab Manual_Part A.docx
C_Lab Manual_Part A.docxC_Lab Manual_Part A.docx
C_Lab Manual_Part A.docx
 
Develop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdfDevelop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdf
 
9781285852744 ppt ch08
9781285852744 ppt ch089781285852744 ppt ch08
9781285852744 ppt ch08
 
R Programming: Introduction to Matrices
R Programming: Introduction to MatricesR Programming: Introduction to Matrices
R Programming: Introduction to Matrices
 
C programs
C programsC programs
C programs
 
Data Structure & Algorithms - Matrix Multiplication
Data Structure & Algorithms - Matrix MultiplicationData Structure & Algorithms - Matrix Multiplication
Data Structure & Algorithms - Matrix Multiplication
 
Tutorial 04 (revised) (1)
Tutorial 04 (revised) (1)Tutorial 04 (revised) (1)
Tutorial 04 (revised) (1)
 

More from Rumman Ansari

More from Rumman Ansari (20)

Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
Java Tutorial best website
Java Tutorial best websiteJava Tutorial best website
Java Tutorial best website
 
Java Questions and Answers
Java Questions and AnswersJava Questions and Answers
Java Questions and Answers
 
servlet programming
servlet programmingservlet programming
servlet programming
 
C program to write c program without using main function
C program to write c program without using main functionC program to write c program without using main function
C program to write c program without using main function
 
Steps for c program execution
Steps for c program executionSteps for c program execution
Steps for c program execution
 
Pointer in c program
Pointer in c programPointer in c program
Pointer in c program
 
My first program in c, hello world !
My first program in c, hello world !My first program in c, hello world !
My first program in c, hello world !
 
How c program execute in c program
How c program execute in c program How c program execute in c program
How c program execute in c program
 
What is token c programming
What is token c programmingWhat is token c programming
What is token c programming
 
What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programming
 
What is keyword in c programming
What is keyword in c programmingWhat is keyword in c programming
What is keyword in c programming
 
Type casting in c programming
Type casting in c programmingType casting in c programming
Type casting in c programming
 
C Programming Language Part 11
C Programming Language Part 11C Programming Language Part 11
C Programming Language Part 11
 
C Programming Language Part 9
C Programming Language Part 9C Programming Language Part 9
C Programming Language Part 9
 
C Programming Language Part 8
C Programming Language Part 8C Programming Language Part 8
C Programming Language Part 8
 
C Programming Language Part 7
C Programming Language Part 7C Programming Language Part 7
C Programming Language Part 7
 
C Programming Language Part 6
C Programming Language Part 6C Programming Language Part 6
C Programming Language Part 6
 
C Programming Language Part 5
C Programming Language Part 5C Programming Language Part 5
C Programming Language Part 5
 
C Programming Language Part 4
C Programming Language Part 4C Programming Language Part 4
C Programming Language Part 4
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

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.