Cod sursa(job #926773)

Utilizator hrazvanHarsan Razvan hrazvan Data 25 martie 2013 12:49:07
Problema Text Scor 100
Compilator c Status done
Runda Arhiva de probleme Marime 0.67 kb
#include <stdio.h>

int main()
{
    FILE *in,*out;
    int b=1,nrl=0,gasit=0,nrc=0;
    char ch;
    in=fopen("text.in","r");
    out=fopen("text.out","w");
    while(b==1)
    {
        ch=fgetc(in);
        if(ch!=EOF)
        {
            if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
            {
                nrl++;
                if(gasit==0)
                    gasit=1;
            }
            else
            {
                if(gasit==1)
                {
                    nrc++;
                    gasit=0;
                }
            }
        }
        else
            b=0;
    }
    fprintf(out,"%d",nrl/nrc);
    return 0;
}