1. You should post your code here, using code tags.
2. You need to make sure your code is well formatted - there appear to be a few attempts, but overall, it is lacking. It should look more like this:
Code:
#include <stdio.h>
int check(int n);
int main()
{
int number;
int x;
int answer;
scanf("%d", &number);
for(x=0; x<number; x++)
{
answer = number / x;
if(answer * x == number)
{
printf("\n %d", answer);
}
if(check(answer) == 1)
{
printf(" ---- PRIME");
}
else
{
printf(" ---- NOT PRIME");
}
}
getch();
}
check(n)
{
int c = 2;
for ( c = 2 ; c <= n - 1 ; c++ )
{
if ( n%c == 0 )
{
return 0;
break;
}
}
if ( c == n )
{
return 1;
}
}
3. Heed all compiler warnings and errors:
Code:
||=== scrap_c, Debug ===|
main.c||In function 'main':|
main.c|26|warning: implicit declaration of function 'getch'|
main.c|30|warning: return type defaults to 'int'|
main.c||In function 'check':|
main.c|30|warning: type of 'n' defaults to 'int'|
main.c|46|warning: control reaches end of non-void function|
||=== Build finished: 0 errors, 4 warnings ===|
>> warning: implicit declaration of function 'getch'
This is a non-standard function. Consider using "getchar()" instead.
>> warning: return type defaults to 'int'
>> warning: type of 'n' defaults to 'int'
This is because your function definition is wrong - it should look just like the declaration (up top), only without the semi-colon.
>> warning: control reaches end of non-void function
This means there might be control paths in your function that do not lead to a "return", though that function claims to always be returning a value.
--------
gemera already gave you key information pertaining to your problem, so you now have quite a bit to go on with.