Here is an easy Voltage and Resistance calculator tool for IC such as LM117, LM317, LM338, LM350 etc which is a family of 3 terminal programmable regulator. Typically R2 is made Adjustable.
*Note-> The input voltage to the LM317 must be at least 1.5v greater than the output voltage. Maximum output voltage is 37 V
Three Terminal Regulatore like LM317 are easy to use and require only two external resistors to set the output voltage.
This LM317 IC is commonly used in home UPS to charge battery at required voltage level.This protect over charge of battery.
For Shunt Regulator (Programmable Zener Diode) like TL431 which is commonly used in mobile charger, Laptop charger, the output voltage is double after calculation and circuit diagram is different.Home of circuit easy