Cod sursa(job #797201)
| Utilizator | Data | 13 octombrie 2012 17:01:57 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.41 kb |
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void main()
{
int c=0,i=0;
FILE *f,*g;
char s[50], *p;
f=fopen("text.in","r");
g=fopen("text.out","w");
while ( fgets ( s, sizeof(s), f ) != NULL )
{
p=strtok(s," /-?!;',:");
while(p)
{
c++;
i+=strlen(p);
p=strtok(NULL," /-?!;',:");
}
}
/*fprintf(g,"%d\n%d",i,c);
*/
fprintf(g,"%d",i/c);
fclose(f);
fclose(g);
}