-
Notifications
You must be signed in to change notification settings - Fork 3
/
Week 4 Q5.c
42 lines (33 loc) · 868 Bytes
/
Week 4 Q5.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<stdio.h>
void main(){
int i=0,k=0,j,q;
FILE *fp1, *fp2;
char a,b;
fp1 = fopen("open_1.txt","r");
fp2 = fopen("open_5.txt","r");
do{
do{
if(a!=EOF){
a=fgetc(fp1);
printf("%c",a);
}else{
do{
b=fgetc(fp2);
printf("%c",b);
}while(b!='\n');
}
}while((a!='\n') && (a!=EOF));
do{
if(b!=EOF){
b=fgetc(fp2);
printf("%c",b);
}else{
do{
a=fgetc(fp1);
printf("%c",a);
}while(a!='\n');
}
}while((b!='\n') && (b!=EOF));
}while((a!=EOF) || (b!=EOF));
fclose(fp1); fclose(fp2);
}