Skip to content

Commit

Permalink
13 | till 15 | sharafat
Browse files Browse the repository at this point in the history
  • Loading branch information
SharafatKarim committed Aug 17, 2023
1 parent 89a8dc2 commit 8fc17ba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
19 changes: 19 additions & 0 deletions solutions/sharafat/13/15.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <stdio.h>

int main()
{
FILE *fp1, *fp2;
int num;
fp1 = fopen("DATA1", "r");
fp2 = fopen("DATA2", "w");

fseek(fp2, 0, 2);

fscanf( fp1, "%d", &num);
while ( !feof(fp1) )
{
fprintf( fp2, "%d\n", num * num);
fscanf( fp1, "%d", &num);
}
return 0;
}
3 changes: 1 addition & 2 deletions solutions/sharafat/13/4.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ int main()
fp1 = fopen("DATA1", "r");
fp2 = fopen("DATA2", "a");

// fseek(fp1, 0, 2);
fseek(fp2, 0, 2);

fscanf( fp1, "%d", &num);
fscanf( fp1, "%d", &num);
while ( !feof(fp1) )
{
fprintf( fp2, "%d\n", num);
Expand Down

0 comments on commit 8fc17ba

Please sign in to comment.