>but i aint workin'
There are several syntax errors that keep it from compiling. But past that your computations are off. Consider how one would simply calculate whether a number is prime:
Code:
/* Pseudocode: I hold no responsibility for errors syntactic, logical, or mathematical ;) */
int main ( void )
{
int val, i, flag = 1;
printf ( "Enter a number: " );
if ( scanf ( "%d", &val ) == 1 ) {
if ( val == 1 ) flag = 0;
for ( i = 2; i < val; i++ )
if ( i < val && val % i == 0 )
flag = 0;
printf ( "%d is %sprime\n", val,
flag != 1 ? "not " : "" );
}
return 0;
}
Loop through all values less than your value. If your value is divisible by any of them then it is not prime. This is a slower method, but it should work for what you need.
-Prelude