Pagini recente » Cod sursa (job #1765206) | Cod sursa (job #1662943) | Cod sursa (job #951348) | Cod sursa (job #2256619) | Cod sursa (job #1506230)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{ int word=0,c=0,k=0; //word = nr de cuv, ch= nr de litere
char ch;
FILE *f = fopen("text.in","r");
FILE *g = fopen("text.out","w");
while(fscanf(f,"%c",&ch)!=EOF){
if((ch >='a' && ch <='z') || (ch >='A' && ch <='Z')){
c++;
if(k==0){
word++;
k = 1;
}
}
else{
k=0;
}
}
k = c/(word);
fprintf(g,"%d",k);
return 0;
}