I'm trying to create a program that will determine whether the input number is a prime number. I've hit a roadblock though. Here's the code.
The problem I keep getting is that the program never reaches the "else" to increment the divisor. I can't figure out why. Can anyone help?Code:#include<stdio.h>
int main(void)
{
int number;
int count;
int divisor = 2;
printf("Input number for primality testing\n");
scanf("d",number);
while (divisor < number/2) {
if (number % divisor == 0) {
break;
}
else {
divisor++;
}
}
if (divisor >= number/2) {
printf("Number is prime\n");
}
else {
printf("Number is not prime\n");
}
return 0;
}