Problem: Write a c program to search an element in the two-dimensional array. If present then prints its “Index position” otherwise output “Not Found”.

Example:

Steps to search element in a 2D array:

  1. Input array.
  2. Input the search element.
  3. Traverse the array using nested for loop and check for each element whether it is equal to the search element or not.
  4. If a match is found then output the index position of the match.
  5. if not a single match was found while traversing the array, output ‘Not Found’.

Here is the implementation of the steps in the c programming language.

Output 1:

Output 2:

In this tutorial, we learned to search an element in a two-dimensional array in the c programming language. If you have any suggestions or doubts then comment below.

Leave a Reply