Cod sursa(job #341653)

Utilizator ZethpixZethpix Zethpix Data 19 august 2009 08:40:57
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <stdio.h>
FILE *f,*g;
char c;
int ok;
long s,n;
int main(){
	f=fopen("text.in","r");
	g=fopen("text.out","w");
	n=s=0;
	while (!feof(f)){
		fscanf(f,"%c",&c);
	if (65<=c&&c<=90||97<=c&&c<=122){
			ok=1;
			n++;
		}
		else
			if (ok==1){
				ok=0;
				s++;
			}
	}
	if (65<=c&&c<=90||97<=c&&c<=122){
		n++;
		s++;
	}
	fprintf(g,"%ld\n",n/s);
	fclose(f);
	fclose(g);
}