You are getting Floating point exception because Number % i, when i is 0:
int Is_Prime( int Number ){
int i ;
for( i = 0 ; i < Number / 2 ; i++ ){ if( Number % i != 0 ) return -1 ; } return Number ; } Just start the loop at i = 2. Since i = 1 in Number % i it always be equal to zero, since Number is a int. Floating Point Exception happens because of an unexpected infinity or NaN. You can track that using gdb, which allows you to see what is going on inside your C program while it runs. For more details: https://www.cs.swarthmore.edu/~newhall/unixhelp/howto_gdb.php In a nutshell, these commands might be useful... gcc -g myprog.c gdb a.out gdb core a.out ddd a.out