Cod sursa(job #694490)
Utilizator | Data | 27 februarie 2012 21:19:20 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include<stdio.h>
#include<string.h>
FILE *fin, *fout;
main()
{
fin = fopen("text.in","r");
fout = fopen("text.out","w");
char c;
long l,nr,f,i,ok;
nr=0;
l=0;
ok=0;
while(fscanf(fin,"%c",&c)!=EOF)
{
if(c>='a' && c<='z' || c>='A' && c<='Z')
{
l++;
ok=1;
}
else
if(ok==1)
{
nr++;
ok=0;
}
}
f=l/nr;
fprintf(fout,"%d",f);
fclose(fin);
fclose(fout);
}