Cod sursa(job #268074)
| Utilizator | Data | 28 februarie 2009 19:11:00 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <stdio.h>
#include <ctype.h>
char x;
int s, c, ok = 0;
void citeste ()
{
FILE * in = fopen("text.in", "r");
while (!feof(in))
{
fscanf(in, "%c", &x);
if (!ok && isalpha(x))
{
s++;
c++;
ok=1;
}
else if (ok && isalpha(x))
{
s++;
}
else
{
ok=0;
}
}
fclose(in);
}
void scrie ()
{
FILE * out = fopen("text.out", "w");
fprintf(out, "%d", (s/c));
fclose(out);
}
int main ()
{
citeste();
scrie();
return 0;
}
