Cod sursa(job #2556315)
| Utilizator | Data | 24 februarie 2020 20:07:22 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | c-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.56 kb |
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
FILE *fin, *fout;
void read()
{
char c;
int nrwords = 0, wlen = 0;
while((c = fgetc(fin)) != EOF)
{
if(isalpha(c))
{
nrwords++;
wlen++;
while(isalpha(c = fgetc(fin)))
{
wlen++;
}
}
}
fprintf(fout, "%d", wlen/nrwords);
}
int main()
{
fin = fopen("text.in","r"), fout = fopen("text.out", "w");
read();
fclose(fin);fclose(fout);
return 0;
}
