Originally Posted by
Bubbles293
Crap do u no what is wrong wit the code?
Yes. Firstly, it is very poorly formatted. Here is an example of your code with good formatting:
Code:
#include<stdio.h>
#include<math.h>
int main(void)
{
int n, i, a;
printf("enter the number");
scanf("%d", &n);
for (i = 2; i <=n; i++)
{
a = n % i;
if (a == 0)
{
printf("the number is not a prime number");
return 1;
}
else
{
printf("the number is prime");
return 0;
}
}
}
_Mike has described the logic error that my test input demonstrates.