Cod sursa(job #154852)
| Utilizator | Data | 11 martie 2008 15:25:35 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <stdio.h>
#include <ctype.h>
int main(){
char c;
long litere=0,aux=0,cuv=0;
int flag=1;
FILE *f=fopen("text.in","r");
while(!feof(f)){
fscanf(f,"%c",&c);
if(isalpha(c)) aux++;
if(isdigit(c))
if(aux)
flag=0;
if(c==' '){
if(flag){
litere+=aux;
cuv++;
aux=0;
}
else {
aux=0;
flag=1;
}
}
}
FILE *g=fopen("text.out","w");
fprintf(g,"%ld\n",litere/cuv);
fclose(g);
return 0;
}
