You are given a positive integer x. Determine whether it is prime or not? A prime number is a whole …

Click here to read the complete problem statement.

If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

What’s the problem with this code? It gets wrong ans on test 6

N = int(input())
def isprime(n):
if (n > 1):
for i in range(2, n):
if n % i == 0:
return False
else:
return True
else:
return False
if isprime(N):
print('Yes')
else:
print('No')

According to your definition, the only prime number is 1 (which is ironic, since 1 is not actually prime). All other positive integers are divisible by (at least) themself and 1, making them non-prime according to your definition.

#include <stdio.h>
int main ()
{
int N, i, k=0;
scanf("%d", &N);
if (N==1000)
if ( N==1 || N==0)
k=1;
for(i=2; i<N; i++)
{
if(N%i==0)
k++;
break;
}
if(k==0)
printf("\Yes");
else
printf("\No");
return 0;
}