Cod sursa(job #1250388)
| Utilizator | Data | 28 octombrie 2014 01:18:05 | |
|---|---|---|---|
| Problema | Text | Scor | 50 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <stdio.h>
#include <string.h>
int main()
{
char cuvant;
int lungTotal = 0, nrCuvinte = 0, ok = 0;
FILE *f = fopen("text.in","r");
FILE *g = fopen("text.out","w");
while ( !(feof(f)) )
{
fscanf(f,"%c",&cuvant);
if ((cuvant >= 'A' && cuvant <= 'Z') || (cuvant >= 'a' && cuvant <= 'z'))
{
ok = 1;
lungTotal++;
}
else
{
if (ok == 1)
{
ok = 0;
nrCuvinte++;
}
}
}
nrCuvinte++;
fprintf(g,"%d",lungTotal/nrCuvinte);
fclose(f);
fclose(g);
}