Cod sursa(job #2044899)

Utilizator alexc11Alex C alexc11 Data 21 octombrie 2017 16:14:18
Problema Text Scor 100
Compilator c Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <stdio.h>

int main() {
    int litere = 0, cuv = 0;
    char c;
    FILE *f, *g;
    f = fopen("text.in","r");
    g = fopen("text.out","w");
    int t=0;
    while(!feof(f)) {
        fscanf(f, "%c", &c);
        if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
            litere++;
            t=1;
        }
        else if (t) {
            cuv++;
            t=0;
        }
    }
    fprintf(g, "%d", litere/cuv);
}