Cod sursa(job #1506335)

Utilizator mitroi_stefan_danielMitroi Stefan-Daniel mitroi_stefan_daniel Data 20 octombrie 2015 14:56:28
Problema Text Scor 100
Compilator c Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <stdio.h>
#include <stdlib.h>

int main(){

    int nr_cuv=0,c=0,k=0;
    char ch;

    FILE *f,*g;

    f= fopen("text.in","r");
    g= fopen("text.out","w");


    while(fscanf(f,"%c",&ch)!=EOF){
        if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')){
            c++;
            if(k==0){
                nr_cuv++;
                k = 1;
            }
        }
        else
            k=0;
    }


    k = c/nr_cuv;

    fprintf(g,"%d",k);

    return 0;
}