Answer to Question for-2

  int p = 1;
  for(int i = 1; i <= n; i++)
  {
    p *= x;
  }