Cod sursa(job #393214)
Utilizator | Data | 9 februarie 2010 08:30:23 | |
---|---|---|---|
Problema | Text | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include <stdio.h>
#include <ctype.h>
FILE *f=fopen ("text.in", "r");
FILE *g=fopen ("text.out", "w");
char x;
int k,nr;
int main() {
while (!feof(f))
{
fscanf (f, "%c", &x);
if (isalpha(x))
{ nr++;
while (isalpha(x))
{ k++; fscanf (f, "%c", &x); }
}
}
fprintf (g, "%d", k/nr);
return 0;
}