Cod sursa(job #1247536)
Utilizator | Data | 22 octombrie 2014 22:24:28 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | c | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include<stdio.h>
int main()
{
FILE *f = fopen("text.in", "r");
FILE *g = fopen("text.out", "w");
char ch;
int ok = 0;
int count = 0;
int sum = 0;
do
{
fscanf(f, "%c", &ch);
if((ch>='a' && ch <='z') || (ch>='A' && ch <='Z'))
{
sum++;
if(!ok)
{
ok = 1;
count++;
}
}
else
ok = 0;
}
while(ch != '\n');
fprintf(g, "%d", sum/count);
return 0;
}