Depending on the country, the person who becomes the president is:
the speaker of the house.
Secretary of State
If the presidency is vacancy. the VP becomes president and and new VP is promptly appointed . If the president and VP both die at once, the Speaker of the House becomes president.
President then Vice President then Speaker of the House.
If the U. S. President dies, resigns or is removed from office, the Vice President immediately becomes the President. If there is no Vice President at that time, the Speaker of the U. S. House of Representatives becomes the President. If there is no House Speaker at that time, or if the House Speaker is unable, unwilling or not qualified to be President, the President Pro Tempore of the U. S. Senate, who is by tradition the most senior member of the majority party of the Senate, becomes President. If there is no Senate President Pro Tem at that time, or if he/she is unable, unwilling or not qualified to be President, the U. S. Secretary of State becomes President. If there is no Secretary of State at that time, or if he/she is unable, unwilling or not qualified to be President, the U. S. Treasury Secretary becomes President (if qualified, willing and able). Whoever becomes President appoints a Vice President after taking office. That person takes office after both houses of Congress approve the appointment.
Then the vice president-elect becomes president.
The vice-president becomes President if the president can not function.
The vice president would become the acting president.
If both die then the Speaker of the House becomes president
President pro tempore of the Senate becomes President.
The President is still the President if he or she is out of the country - it's only when he or she is INCAPACITATED that the Vice-President becomes (acting) President.
The New President Chooses a Replacement , (:
Death of a sitting president the Vice President becomes president, election, or by resignation and the Vice President again becomes president.
Vice President
the secretary of state
The president 's choice (subject to the consent of both Houses of Congress)
The Speaker of the House of Representatives. If they can not serve, then the President pro tempore becomes the President.