This is a difficult question to answer. The standard reply is to look at the size of the image in pixels, divide this by the print resolution (in dpi) and that gives you the maximum size you can print. However...
The problem is this can give you a size smaller than you can really get a good print . Mainly because dpi ( dots per inch) isn't the same a ppi ( pixels per inch) and there isn't really a simple conversion.
To give yo and example I have some images that were taken on a Canon 300D several years ago. A 6 Mp camera. Now using the dpi figure , the largest size I could have printed was around 7" x 10". Now OK it wasn't the kit lens I was using but something a lot better, but I have so 20" x 30" from the camera that look sharp even fairly close up, ( about 20" ). So how does this happen.
Well as I said earlier there is no real correlation between dpi and ppi. Plus there is a lot happening in image processing. Not adding excessive sharpening will help. Use output sharpening rather than input sharpening, as the later is applied to the output rastered image. Plus the quality of the printer will help as well, as does the rendering software that it is using.
So as a rule of thumb you can use the resolution in pixels/ dpi to give you a good guide. But don't be put off if the calculation says 12 x 18 and you want 20 x 16. You'll still probably get a good print.
Just don't over process the image, whatever size you want