C programming: Doing error checking with scanf.
scanf will return the number of values successfully read in. If the user types a letter instead of a numbers, scanf will return 0.
You can add a while loops to keep re-prompting until the user types a number instead of a letter to avoid an infinite loop if the user accidentally types in the wrong data type.