Cod sursa(job #208345)

Utilizator pitbullpitbulll pitbull Data 15 septembrie 2008 22:12:38
Problema Text Scor 40
Compilator c Status done
Runda Arhiva de probleme Marime 0.41 kb
# include <stdio.h>
# include <string.h>

# define MAX 1001;
char c;
int nr1,nr2;


int main (){
	FILE *f=fopen("text.in","r");
	
	while((c=fgetc(f))!=EOF)
		{
			if(c>='A'&&c<='Z' || c>='a'&&c<='z' || c>='0' && c<='9')
				nr1++;
			else if (c ==' '||c == '!' ||c=='?' || c=='-') 
				nr2++;
		}
	fclose(f);
	
	
	f=fopen("text.out","wt");
	fprintf(f,"%d",nr1/nr2);
	fclose(f);
	return 0;
}