first useful programs were knitting mills and carpet machines around 1800 - there was no conditional logic, just a long loop of effectively what were just print statements. See jacquard looms on wikipedia - https://en.wikipedia.org/wiki/Jacquard_loom#/media/File:Jacq...
first real program is often attributed to Countess Ada Lovelace, in describing operations of the Babbage machine in 1843. She even had a bug in her "code". https://en.wikipedia.org/wiki/Ada_Lovelace#First_computer_pr...