Mai intai trebuie sa te autentifici.
Cod sursa(job #1493024)
Utilizator | Data | 28 septembrie 2015 16:56:18 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | c | Status | done |
Runda | Arhiva de probleme | Marime | 0.55 kb |
#include<stdio.h>
main()
{
FILE *in,*out;
int litere = 0;
int cuvinte = 0;
char c;
char x;
int nc;
in = fopen("text.in","r");
out = fopen("text.out","w");
while(!feof(in))
{
fscanf(in,"%c",&c);
if((c >= 'a')&&(c <= 'z')||(c >= 'A')&&(c <= 'Z'))
{
litere++;
x = c;
nc = 0;
}
else
{
nc = 1;
if (((x >= 'a')&&(x <= 'z')||(x >= 'A')&&(x <= 'Z'))&& nc)
{
cuvinte++;
x = c;
}
}
}
fprintf(out,"%d",litere/cuvinte);
fclose(in);
fclose(out);
}