Of the 45 men elected president of the United States, 31 had prior military service, while only 14 had no prior military service. Their service ranks range from private in a state militia to the general of the army.