Ok I redid my program with some help and now i'm getting an illegal break error any reasons why
Code:
#include <stdio.h>
int main()
{
int a,b,c,num,scan,data[1000];
FILE *input, *divide3, *rest;
input=fopen("numberlist.txt","r");
divide3=fopen("divide3.txt","w");
rest=fopen("rest.txt","w");
printf("Type in the multiple to seperate files by\n");
scanf("%d", &a);
if (input==NULL)
{
printf("Cannot locate file\n");
Exit();
}
for (c=0; input !=NULL; c++);
{
scan=fscanf(input, "%d\n", &data[c]);
{
num = c--;
break;
}
}
for(c=0; c<num; c++)
{
if(data[c]%a==0)
{
fprintf(divide3, "%d\n", data[c]);
b++;
}
else
fprintf(rest, "%d\n", data[c]);
}
fclose(data);
fclose(divide3);
fclose(rest);
return 0;
}