this is a code for generating prime number.here i am checking the number to be divisible by 2 ,3 & 5 first & after that by 7 , 11 & 13 and after that if it is divided by any prime number from 13 to 997.

the link to problem is http://www.codechef.com/problems/PRIME1

the link to my code is http://www.codechef.com/viewsolution/5638185

you stored primes upto 1000 , whereas primes can be much much larger than that .

ok…thank you

ok here is the new code for the same problem

http://www.codechef.com/viewsolution/5638543

But here i am divding the number upto ceiling of sqrt only.but still getting wrong answer.

Your final code is not giving any output on most of cases like

if m = 10 , n = 20;

and your first code was giving wrong output in cases like

if m=4,n = 4, out put should be a blank like but your program gives an output of integer 2.

ok.fixed another problem now it should be working.problem was with for loop bracket.

http://www.codechef.com/viewsolution/5638838

Yet a lot of inputs are not working like…

testcases=2

m=1 n=2

m=2 n=5

it gives out put 1 3 5

whereas output should be 2 2 3 5

If it really helped just accept this as answer by clicking the green tick button bellow my answer

Still there is a wrong input m=1,n=1 in ur program it is considered that 1 is a prime number

thnks.after fixing the above problem , solution is still wrong.

http://www.codechef.com/viewsolution/5640272