#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int b[100],i,j,n,e;
FILE *f,*r;char s[15];
int main()
{ puts("File Name");
  scanf("%s",s);
  f=fopen(s,"r");
  i=0;  while((i<100)&&(fscanf(f,"%d",&e)!=EOF))
 { b[i]=e;i++; }
  if(i<100)n=i;
   else n=100;
   puts("Inputed Massiv");
   for(i=0;i<n;i++) printf("%4d",b[i]);
       printf("\n");
   j=-1;
   for(i=0;i<n;i++)
   if (b[i]>=0)
    { j=j+1;
      b[j]=b[i]; }
   for(i=j+1;i<n;i++)
     b[i]=0;
       n=j+1;
  if (n==0)
  puts("Empty Massiv n=0");
  else
  { puts("File Name result");
    scanf("%s",s);
    r=fopen(s,"w");
    fputs("New  Massiv\n",r);
    for(i=0;i<n;i++)fprintf(r,"%4d",b[i]);
    fprintf(r,"\n");
    fclose(r);
    if((r=fopen(s,"r"))!=NULL)
    { fgets(s,15,r);
      puts(s);
      for(i=0;i<n;i++)
       { fscanf(r,"%d",&e);
         printf("%4d",e); }
         printf("\n");  }
    }
  return 0;}

