Cod sursa(job #1694217)

Utilizator andreicoman299Coman Andrei andreicoman299 Data 24 aprilie 2016 22:20:46
Problema Text Scor 100
Compilator c Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <stdio.h>
#include <stdlib.h>

int main(){
    int nrlit, nrcuv;
    FILE*fi,*fo;
    fi=fopen("text.in","r");
    fo=fopen("text.out","w");
    nrlit=nrcuv=0;
    char cpr, c;
    cpr=' ';
    c=fgetc(fi);
    while(c!=EOF){
        if(('a'<=c && c<='z') || ('A'<=c && c<='Z')){
            nrlit++;
            if(cpr<'A' || (cpr>'Z' && cpr<'a') || cpr>'z')
                nrcuv++;
        }
        cpr=c;
        c=fgetc(fi);
    }
    fprintf(fo,"%d", nrlit/nrcuv);
    fclose(fi);
    fclose(fo);
    return 0;
}