The story of military leaders metamorphosing into presidents is probably half of the entire political history of post-colonial Africa, and nowhere is a better example than Nigeria.
The country has been under the leadership of 13 Nigerians since its independence in 1960. Seven of these leaders either oversaw military governments or were connected to the military.
For the avoidance of doubt, a president is different from any other kind of leader insofar as the president’s position is designated as such, per constitutional rudiments. So although all of the 13 men were heads of state, technically, not all of them were presidents of Nigeria.
Some of Nigeria’s military capos were appointed while others were elected. In all, four (ex-)military men have so far been designated as presidents of Nigeria.