1. James Madison: Madison served in the United States House of Representatives from 1789 to 1797 and was the fourth President of the United States from 1809 to 1817.
2. John Quincy Adams: Adams served in the United States Senate from 1803 to 1808 and was the sixth President of the United States from 1825 to 1829.
3. James K. Polk: Polk served in the United States House of Representatives from 1825 to 1839 and was the 11th President of the United States from 1845 to 1849.
4. Abraham Lincoln: Lincoln served in the United States House of Representatives from 1847 to 1849 and was the 16th President of the United States from 1861 until his assassination in 1865.
5. Rutherford B. Hayes: Hayes served in the United States House of Representatives from 1865 to 1877 and was the 19th President of the United States from 1877 to 1881.
6. James Garfield: Garfield served in the United States House of Representatives from 1863 to 1880 and was the 20th President of the United States from 1881 until his assassination in the same year.
These are just a few examples of presidents who served in Congress before becoming president. There are other presidents who also served in Congress, but this list is not exhaustive.