Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- int red=0, n, i, brZbor, prosek, counter=0;
- char str[100];
- int niza[100];
- FILE *fin;
- FILE *fout;
- if((fin=fopen("vlez.txt","r"))==NULL)
- {
- printf("Ne postoi.");
- exit(1);
- }
- if((fout=fopen("izlez.txt", "w"))==NULL)
- {
- printf("Ne postoi.");
- exit(1);
- }
- for(i=0; i<100; i++)
- {
- niza[i]=0;
- }
- while(fgets(str, 80, fin)!=NULL)
- {
- n=strlen(str);
- i=0;
- while(i<n)
- {
- if(isalnum(str[i]))
- {
- brZbor=0;
- while(i<n && isalnum(str[i]))
- {
- i++;
- }
- brZbor++;
- }
- else
- {
- i++;
- }
- }
- niza[red]=brZbor;
- red++;
- }
- prosek=brZbor/red;
- for(i=0; i<red; i++)
- {
- if(niza[i]<prosek)
- {
- counter++;
- }
- }
- fprintf(fout, "%d", counter);
- fclose(fin);
- fclose(fout);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement