Code:
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define M 40

void enterfile(char a[][M],int *n, int *k ){
	FILE* f=fopen("Word Wrap R.txt","r");
	fscanf(f,"%d\n",&k);
	printf("%d\n",k);
	int i=0;
	while(fscanf(f,"%[^ ]",a[i])!=EOF){
		printf("%s\n",a[i]);
		i++;
	}
	*n=i;
	fclose(f);
}
void wordWrap(char a[][M],int n, int k ){
	FILE* f=fopen("Word Wrap W.txt","w");
	int i=0, t=0;
	while(i<n){
		t=0;
		while(t+strlen(a[i])<=k){
			t+=strlen(a[i])+1;
			fprintf(f,"%s ",a[i]);
			i++;
		}	
	}
	fclose(f);
}

int main(void){
	int k,n;
	char a[M][M];
	enterfile(a,&n,&k);
	wordWrap(a,n,k);
	
}
Word Wrap R.txt
Code:
10
This is week 13 of BTP100


e cũng chảng biết nó sai o dau hết ak