I'm busy with a code that __should__ determine whether a certain value is a prime number or not. If the number isn't prime, it should determine the smallest divisor of that value. Unfortunately, I'm having problems getting this to work..

Code:

#include <stdio.h>
int main()
{
int input;/*input variable*/
int i=1; /*used to loop the user input (user should enter an integer greater than '1'*/
int div=0;/*used to determine the smallest divisor of the input value if it is not prime*/
int n=3;/*used in formula to check odd numbers for prime.*/
char rept;/*option to repeat program*/
do
{
do
{
input=i;
printf("\nType a number >1: ");
scanf("%d", &input);//integer input point
getchar();//buffer filter
i++;
}
while(i<=1);
printf("\nYou entered %d.\n", input);
if(input%2==0)
{
div+=i;//sum to determine the smallest divisor, if the input value is even (not prime)
printf("\n%d is the smallest divisor of %d!\n", div, input);
}
else if(input%2==1)
{
n=input/n+1;//sum to determine which odd integers are not prime
div+=n-1;//if the input is odd and is NOT prime, this sum determines the smallest divisor
if(n%2==0)
printf("\n%d is the smallest divisor of %d!\n", div, input);
else if(n%2==1)
printf("%d is a prime number!\n", input);
}
printf("Would you like to try again (y/n)? ");
scanf("%c", &rept);//option to repeat the program...
getchar();//buffer filter
}
while(rept=='y'||rept=='Y');
return 0;
}