Hi all here is code below i did to find a prime number as far as i m concerned it works fine .
and anyone can explain me the correct use of "%"
int count =0;
//checks the programs
if ( b < 0 )
printf("\n\n\tEnter a postive number program ended.",b);
}//the program will not be executed if the user has entered a negative number,
//start for the prime numbers check.
while (a < b)
if ( b % a == 0)//check if the given number has a remainder of the previous numbers.
/*Enable this printf is you want to check on which numbers
the the remainder is zero.
printf ("the remainder is zero on %d\n",a);
count++;//a counter to dertmine how many times the given number has remainder zero.
Enable this part of the program if you want to check on which numbers
the remainder is not zero.
else if ( b % a != 0)
printf("the raimder is not zero on %d\n",a);
//this part of the program uses the counter to print if the number has more then 2
//divisors on which the remainder is zero then it will print the results
if (count >= 2)
printf("\nThe number %d is not prime ",b);
else if ( count <= 2)
printf("\n the number %d is prime ",b);
thanks in advance
edit: how tht post got up there