Cod sursa(job #61794)

Utilizator anna_bozianuBozianu Ana anna_bozianu Data 20 mai 2007 17:37:54
Problema Text Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include<stdio.h>
char c;
long int nl,nc,m,ntl;
int main()
{
	FILE *f=fopen("text.in","rb");
	while(!feof(f))
	{   fscanf(f,"%c",&c);
	    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;
}