Boris Johnson announced his resignation as prime minister of the United Kingdom and expressed regret at "giving up the best job in the world."