Why range error & how to fix it in this program?

Printable View