Cod sursa(job #583015)
Utilizator | Preda Alexandru preda_alexandru | Data | 17 aprilie 2011 12:46:01 |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | c | Status | done |
Runda | Arhiva de probleme | Marime | 0.59 kb |
#include<stdio.h>
int main()
{
char c;
int ok = 0, litere = 0, cuvinte = 0;
FILE *fin, *fout;
fin = fopen("text.in", "rt");
fout = fopen("text.out", "wt");
while( c=fgetc(fin) )
{
if( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') )
{
litere++;
if( !ok )
{
cuvinte++;
ok = 1;
}
}
else
{
ok = 0;
if(c == EOF) break;
}
}
fprintf(fout, "%i",litere/cuvinte);
return 0;
}