Constraints conditions

How to understand constraints conditions?

2 < N <= 1000000000

So, should I use long long int or what

hello @omkarvp99

if the range of data does not exceed 10^9 then use int
otherwise use long long

1 Like

@aman212yadav, Please check my code, give me hint.

ur code will print multiple times not prime.

to avoid it use a boolean variable that will store whether the given number is prime or not.
initially keep that variable as true.
and while iterating if n%i ==0 then turn that boolean variable false.

once iteration is over. chefck the value of boolean variable and print accordingly

@aman212yadav,
Also I can use break statment!!! is it?

yeah to avoid extra number of iterations u can use break

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.