input: Write a function to perform a linear search on a sorted array.
  assert linear_search([1, 2, 3, 4, 5], 5, 3) == 2
  assert linear_search([10, 20, 30, 40, 50], 5, 25) == -1
  assert linear_search([5, 15, 25, 35, 45], 5, 45) == 4
output: def linear_search(arr, n, x):
      for i in range(n):
          if arr[i] == x:
              return i
      return -1