0% found this document useful (0 votes)
11 views

ass6b2

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

ass6b2

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

#include<stdio.

h>
#include<stdlib.h>
main()
{
FILE *fp1,*fp2,*fp3;
char fn1[20],fn2[20],fn3[20];
int i,num;
printf("enter the filenames");
scanf("%s %s %s",fn1,fn2,fn3);
fp1=fopen(fn1,"r");
fp2=fopen(fn2,"w");
fp3=fopen(fn3,"w");

while(!feof(fp1)
{
fscanf(fp1,"%d",&num);
if(num%2==0)

fprintf(fp2,num);

else
fprintf(fp3,num);
}
fcloseall();
fp2=fopen(fn2,"r");
fp3=fopen(fn3,"r");
while(!feof(fp2)
{
fscanf(fp1,"%d",&num);

You might also like