SPOJ - TDPRIMES - TLE with Prime Sieves

Problem: SPOJ.com - Problem TDPRIMES
Code: Coding Blocks IDE

My code is taking 3+ second, the time limit is about 1 second.
Any resource would be helpful.

Thanks!