10 / 10
Apr 2020

#include<stdio.h>
#include<math.h>
int main(){
long long int testcases,factors=0,num,j,i;
scanf("%lld",&testcases);

long long int uppbd[testcases],lwrbd[testcases];

for( i=0;i<testcases;i++)
scanf("%lld %lld",&lwrbd[i],&uppbd[i]);

for( i=0;i<testcases;i++){
    
    for(num=lwrbd[i];num<=uppbd[i];num++){
        factors=3;
        
        if(num<=3&&num>1)
          factors=2;
        else{
            if(((num-1)%6==0||(num+1)%6==0)&&(num>4))
            factors=2;
        }
        
        if(factors==2)
        	printf("%lld\n",num);
    
    }

    
    printf("\n");
}
return 0;

}

Maybe because without submitting it’s not possible? [to get WA :wink: ]
Or maybe because your code write wrong answers?

Please tell me, how much and for how big numbers did you test your program?

I’ve tested it with
1
1 100000
it’s running fine.
please help me bro I’am stuck
(form past 4 days I’ve been doing this)

Ok, very well, than how you check it?
Please make small test:
1
1 100

You could find correct answers on net, but I give you:

List of prime numbers up to 100: 
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,

Please compare that list with answer of your program.

Or plese look for that. It’s show your’s wrong method of prepare prime. Bolded and in [ ] number are of course wrong.
2, 3, 5, [6], 7, 11, [12], 13, 17, [18], 19, 23, [24], 25, 29, [30], 31, 35, [36], 37, 41, [42], 43, 47, [48], 49, 53, [54], 55, 59, [60], 61, 65, [66], 67, 71, [72], 73, 77, [78], 79, 83, [84], 85, 89, [90], 91, 95, [96], 97

or in other form:

n*6  your prime - n*6 +\- 1
0      2, 3  <- it's out of rule
6      5, 7
12    11, 13
18    17, 19
24    23, 25 <--- first wrong
.......
72   71, 73
etc

How odd, when I ran it with the same input, I got a different list

2, 3, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47, 49, 53, 55, 59, 61, 65, 67, 71, 73, 77, 79, 83, 85, 89, 91, 95, 97

Still wrong though.

The point is though, the problem was very easy to spot from a simple test. This is something you could have, and should have, done for yourself. To claim you’d tested 1 to 100000 and “it’s running fine” was clearly nonsense.