Cod sursa(job #61908)
Utilizator | Data | 21 mai 2007 06:14:20 | |
---|---|---|---|
Problema | Text | Scor | 90 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include<stdio.h>
char c;
long int nl,nc,m,ntl;
int main()
{
FILE *f=fopen("text.in","rb");
while(fscanf(f,"%c",&c)!=EOF)
{ if((('a'<=c)&&('z'>=c))||(('A'<=c)&&('Z'>=c))) nl++;
else if(nl){nc++;ntl+=nl;nl=0;}
}
fclose(f);
f=fopen("text.out","w");
if(nc) m=ntl/nc;
fprintf(f,"%ld\n",m);
fclose(f);
return 0;
}