Hey I am learning to program in C at the moment and I'm having a few problems. I keep getting parse errors when I try to compile as well as a problem with the break statement.
Any help would be really appreciated. Thanks.
Code:
/* Check to see if a number is prime or not.
A number is prime if it can only be dividied by itself and 1
but by no other number.
*/
#include <stdio.h>
int main()
{
int prime = 1;
int number;
int count;
printf("Please enter a number ");
if (scanf("%d", number) != 1)
{
printf("Invalid number entered\n");
return 1;
}
for (count=1, count<number, count++);
{
if (number % count = 0)
{
break;
prime = 0;
}
}
if prime
printf("\n$d is prime\n", number);
else
printf("\n$d is not prime\n", number);
return 0;
}