Cod sursa(job #1110362)
Utilizator | Data | 17 februarie 2014 23:48:55 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include<stdio.h>
#include<stdlib.h>
int ok,k,z;
int main()
{
char s;
FILE*f=fopen("text.in","r");
FILE*g=fopen("text.in","w");
while(!feof(f))
{
fscanf(f,"%c",&s);
if((s>='a'&&s<='z')||(s>='A'&&s<='Z')) k++;
else
{
if(k) ok++;
z+=k;
k=0;
}
}
z/=ok;
fprintf(g,"%d",z);
fclose(f);
fclose(g);
return 0;
}