Prints need pixels, not a DPI number
A print is sharp when there are enough pixels for every inch of paper. That density is what people mean by DPI when they talk about prints, although the correct term is PPI, pixels per inch. A photo that is 3000 pixels wide printed 10 inches wide has 300 PPI.
DPI strictly means the dots of ink a printer lays down, which is a property of the printer, not of your file. And the "DPI" or "resolution" field stored inside a JPEG is just a label: changing it from 72 to 300 in an editor, without adding pixels, does not change the print at all. If a website or shop asks for "300 DPI", what it really needs is enough pixels for the size you ordered at 300 per inch. Our page on converting an image to 300 DPI walks through that request step by step.
The maths is simple: pixels needed = print size in inches × PPI. For centimetres, divide by 2.54 first. The calculator above does this for you, in both directions, and the table below has the common sizes.

