input: Write a python function to perform the given while loop operation.
  assert perform_while_loop(10) == 15
  assert perform_while_loop(20) == 31
  assert perform_while_loop(5) == 7
output: def perform_while_loop(n):
      result = 0
      i = 0
      while i < n:
          if i % 2 == 0:
              result += i // 2
          else:
              result += i
          i += 1
      return result