Cod sursa(job #268067)
| Utilizator | Data | 28 februarie 2009 18:52:13 | |
|---|---|---|---|
| Problema | Text | Scor | 90 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <stdio.h>
char x;
int l, s, c;
void citeste ()
{
FILE * in = fopen("text.in", "r");
while (!feof(in))
{
fscanf(in, "%c", &x);
if (((x >= 'a') && (x<='z')) || ((x >= 'A') && (x<='Z')))
{
l++;
}
else if (l != 0)
{
s+=l;
l=0;
c++;
}
}
fclose(in);
}
void scrie ()
{
FILE * out = fopen("text.out", "w");
fprintf(out, "%d", (s/c));
fclose(out);
}
int main ()
{
citeste();
scrie();
return 0;
}
