Cod sursa(job #1014946)
Utilizator | Data | 23 octombrie 2013 18:26:16 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | c | Status | done |
Runda | Arhiva de probleme | Marime | 0.63 kb |
#include<stdio.h>
int main()
{
int cuvinte=0,lungimeText=0,rez=0;
char c,d;
FILE *f = fopen("text.in","r");
{
while( (c=fgetc(f)) != EOF )
{
if(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')
rez++;
else
{
if(rez!=0)
{
lungimeText += rez;
cuvinte++;
rez = 0;
}
}
}
fclose(f);
}
f = fopen("text.out","w");
{
fprintf(f,"%d",lungimeText/cuvinte);
fclose(f);
}
return 0;
}