#include <stdio.h>
#include <stdlib.h>
int main()
{
int ch;
FILE *input= fopen("C:\\Users\\toby\\Desktop\\2012\\input.txt","r");
FILE *above50= fopen("C:\\Users\\toby\\Desktop\\2012\\above50.txt","w");
FILE *below20= fopen("C:\\Users\\toby\\Desktop\\2012\\below20.txt","w");
while(fscanf(input,"%d",&ch)!=EOF)
{
if (ch>50)
{fprintf(above50,"%d\t",ch) ;}
if(ch<20)
{fprintf(below20,"%d\t",ch);}
}
fclose(input);
fclose(above50);
fclose(below20);
return 0;
}