Pagini recente » Cod sursa (job #505787) | Diferente pentru documentatie/textile intre reviziile 84 si 83 | Statistici Cozma Diego (dego) | Cod sursa (job #321340) | Cod sursa (job #1761837)
#include <stdio.h>
int main() {
FILE *fin, *fout ;
fin = fopen ("text.in", "r" ) ;
fout = fopen ("text.out", "w" ) ;
long long l, stare, cuvinte ;
char c ;
c = fgetc (fin) ;
l = 0 ;
stare = 0 ;
cuvinte = 0 ;
while (c != '\n' ) {
if ( ( c >= 'a' && c <='z' ) || (c >= 'A' && c <= 'Z' ) ) {
l++;
if (stare != 1 ) {
cuvinte++;
stare = 1 ;
}
}
else {
stare = 0 ;
}
c = fgetc (fin) ;
}
if (cuvinte > 0 ) {
fprintf (fout, "%lld", l / cuvinte ) ;
}
else {
fprintf (fout, "0" ) ;
}
fclose (fin) ;
fclose (fout) ;
return 0;
}
/// De umplutura