I was the attempting the PRIME1 Problem in the medium section. My code is compiling and running successfully. However, it is not getting accepted as the code is giving the wrong answer for some input. I am not able to find out for which test case it is giving the wrong answer. So please help me, I am new here.

Here is the link to the problem:

PRIME1

And here is my solution: Solution

Well first same pinch my name is also **Shubham** now coming to business

```
for(int i=n; i<=m; i++)
```

{

if(i==1)

{

flag=0;

break;

}

for(int j=2; j<=(int)Math.sqrt(i); j++)

here in your code you are calculating prime between 2 to n then 2 to n+1 and it continues while you have to calculate prime between n to m

your inner loop is faulty one hence it is giving wrong output

If it helps then accept the answer else leave down a comment for improvisation.