Array and Matrix programming exercises and solutions in C

Array:

Array is a linear collection of similar data types elements. Array in C programming are used to store more than one value at a time in a variable which can be easily accessed by their index. Array can be categorized in two categories:
  1. Single dimension array
  2. Multi dimension array
Here is a list of simple programs on array and matrix to practice for beginners:
  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 print all unique elements in the array.
  12. Write a C program to count total number of duplicate elements in an array.
  13. Write a C program to delete all duplicate elements from an array.
  14. Write a C program to count frequency of each element in 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 order.
  20. Write a C program to sort array elements in descending order.
  21. Write a C program to sort even and odd elements of array separately.


  22. Write a C program to add two matrices.
  23. Write a C program to subtract two matrices.
  24. Write a C program to perform Scalar matrix multiplication.
  25. Write a C program to multiply two matrices.
  26. Write a C program to check whether two matrices are equal or not.
  27. Write a C program to find sum of main diagonal elements of a matrix.
  28. Write a C program to find sum of minor diagonal elements of a matrix.
  29. Write a C program to find sum of each row and column of a matrix.
  30. Write a C program to interchange diagonals of a matrix.
  31. Write a C program to find upper triangular matrix.
  32. Write a C program to find lower triangular matrix.
  33. Write a C program to find sum of upper triangular matrix.
  34. Write a C program to find transpose of a matrix.
  35. Write a C program to find determinant of a matrix.
  36. Write a C program to check Identity matrix.
  37. Write a C program to check Sparse matrix.
  38. Write a C program to check Symmetric matrix.



Any doubt or suggestion write here. I will try my best to help. Before posting your code you must escape it to view. To format your source code and use format highlighting, post your source code inside
< code >< pre > -- Your source code -- < /pre >< /code > (Remove spaces from pre and code tags).

11 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This site is really helping me.
    Thanks

    ReplyDelete
    Replies
    1. Thanks for considering this site. I am just trying to share what I know in the hope it might be helpful to someone.

      Delete
  3. Sir could you also add some exercises on strings,functions and recursion, along with pointers.It would be helpful.

    ReplyDelete
    Replies
    1. Surely, you will find them within one or two days.

      Delete
    2. Can you please post the link of function exercises,
      Thank you!

      Delete
    3. This comment has been removed by the author.

      Delete
    4. There is no link here!

      Delete
    5. Currently I am working over it you will have to wait for few days. Sorry for the delay.

      Delete
  4. Pankaj,
    Suddenly i came across this site. But it turned me and make me to spend more time here. I like this very much. Please keep up the good work. God Bless you.

    Thanks,
    Parimelazhgan S

    ReplyDelete
    Replies
    1. Thanks, Parimelazhgan it really feels great when someone adores your work. I am just trying to give my best possible.

      Delete