Cod sursa(job #352182)
| Utilizator | Data | 30 septembrie 2009 17:33:47 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <stdio.h>
char c;
int l,n;
int main() {
FILE *f = fopen("text.in","r");
FILE *g = fopen("text.out","w");
while (fscanf(f,"%c",&c)!=EOF) {
if ((c>='A' && c<='Z') || (c>='a' && c<='z')) {
l++;
while (fscanf(f,"%c",&c)!=EOF && ((c>='A' && c<='Z') || (c>='a' && c<='z')))
l++;
n++;
}
}
fprintf(g,"%d",l/n);
fclose(f);
fclose(g);
return 0;
}